Home python error read_csv in Pandas

error read_csv in Pandas

Author

Date

Category

When I open a dataset, it displays a mistake, although I do not see any problems. How can I fix it?

Parsererror Traceback (Most Recent Call Last)
& lt; ipython-input-5-76a26ffa0a27 & gt; in & lt; module & gt; ()
---- & gt; 1 df = pd.read_csv ("data.csv") ## Connect file
C: \ ProgramData \ Anaconda3 \ Lib \ Site-Packages \ Pandas \ Io \ Parsers.py in Parser_F (Filepath_or_Buffer, Sep, Delimiter, Header, Names, Index_col, UseCols, Squeeze, Prefix, Mangle_Dupe_cols, DType, Engine, Converters, True_Values , false_values, skipinitialspace, skiprows, nrows, na_values, keep_default_na, na_filter, verbose, skip_blank_lines, parse_dates, infer_datetime_format, keep_date_col, date_parser, dayfirst, iterator, chunksize, compression, thousands, decimal, lineterminator, quotechar, quoting, escapechar, comment, encoding , Dialact, Tupleize_cols, Error_Bad_Lines, Warn_Bad_Lines, Skipofooter, DoubleQuote, Delim_Whitespace, Low_Memory, Memory_Map, Float_Precision)
  676 SKIP_BLANK_LINES = SKIP_BLANK_LINES)
  677.
- & gt; 678 RETURN _READ (FilePath_or_Buffer, KWDS)
  679.
  680 Parser_F .__ name__ = Name
C: \ ProgramData \ Anaconda3 \ Lib \ Site-Packages \ Pandas \ Io \ Parsers.py in _read (FilePath_or_Buffer, KWDS)
  444.
  445 try:
- & gt; 446 Data = Parser.Read (NROWS)
  447 FINALLY:
  448 PARSER.Close ()
C: \ ProgramData \ Anaconda3 \ Lib \ Site-Packages \ Pandas \ Io \ Parsers.py In Read (Self, Nrows)
  1034 Raise Valueerror ('SkipFooter Not Supported For Iteration')
  1035.
- & gt; 1036 RET = Self._engine.read (NROWS)
  1037.
  1038 # May alter columns / col_dict
C: \ ProgramData \ Anaconda3 \ Lib \ Site-Packages \ Pandas \ Io \ Parsers.py In Read (Self, Nrows)
  1846 DEF Read (Self, NROWS = NONE):
  1847 Try:
- & gt; 1848 Data = Self._Reader.Read (NROWS)
  1849 Except Stopiteration:
  1850 IF Self._first_chunk:
Pandas \ _libs \ parsers.pyx in pandas._libs.parsers.textReader.read ()
Pandas \ _libs \ parks.pyx in pandas._libs.parsers.textReader._Read_Low_Memory ()
Pandas \ _libs \ parsers.pyx in pandas._libs.parsers.textReader._Read_ROWS ()
Pandas \ _libs \ parks.pyx in pandas._libs.parsers.textReader._Tokenize_rows ()
Pandas \ _libs \ parks.pyx in pandas._libs.parsers.raise_parser_error ()
Parsererror: Error Tankenizing Data. C ERROR: EXPECTED 6 FIELDS IN LINE 396, SAW 7

Dataset looks whole, and was outbill from a reliable source. Link to .csv


Answer 1, Authority 100%

Try this:

fn = r'c: \ download \ data-9776-2018-10-24.csv '
df = pd.read_csv (fn, sep = ';', encoding = 'cp1251')

Result:

in [139]: df
Out [139]:
   Latitude_wgs84 Name ... Geodata Unnamed: 14
0 55.756165 Urban Wi-Fi ... {Type = Point, Coordinates = [37.62338815, 55.7561 ... Nan
1 55.745141 Urban Wi-Fi ... {Type = Point, Coordinates = [37.618774048, 55.745 ... Nan
2 55.743325 urban Wi-Fi ... {type = point, coordinates = [37.615476946, 55.743 ... Nan
3 55.741227 Urban Wi-Fi ... {Type = Point, Coordinates = [37.611919344, 55.741 ... Nan
4 55.739825 Urban Wi-Fi ... {Type = Point, coordinates = [37.60956385, 55.7398 ... Nan
5 55.746453 Urban Wi-Fi ... {Type = Point, Coordinates = [37.618727711, 55.746 ... Nan
6 55.744822 Urban Wi-Fi ... {Type = Point, Coordinates = [37.613575947, 55.744 ... Nan
... ... ... ... ... ...
1425 55.730729 Urban Wi-Fi ... {Type = Point, Coordinates = [37.611766372, 55.730 ... Nan 
1426 55.739136 Urban Wi-Fi ... {type = point, coordinates = [37.616166833, 55.739 ... Nan
1427 55.738128 Urban Wi-Fi ... {Type = Point, Coordinates = [37.616791858, 55.738 ... Nan
1428 55.733356 Urban Wi-Fi ... {Type = Point, Coordinates = [37.609650507, 55.733 ... Nan
1429 55.759070 urban Wi-Fi ... {type = point, coordinates = [37.656035468, 55.759 ... nan
1430 55.782395 Urban Wi-Fi ... {Type = Point, Coordinates = [37.579823295, 55.782 ... Nan
1431 55.745912 Urban Wi-Fi ... {Type = Point, Coordinates = [37.648522245, 55.745 ... Nan
[1432 Rows X 15 Columns]

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions