我无法用panda打开csv文件

时间:2018-04-21 14:53:59

标签: python python-3.x pandas parsing dataframe

我是从熊猫开始的。我已经用它打开了csv文件,但我不知道如何打开没有空格的文件。

It's the picture of the file

import pandas as pd vdez = pd.read_csv("201712_Diarias.csv", encoding
= 'ISO-8859-1')
**--------------------------------------------------------------------------- CParserError                              Traceback (most recent call last) <ipython-input-24-4bc7449a8703> in <module>()
----> 1 vdez = pd.read_csv("201712_Diarias.csv", encoding = 'ISO-8859-1')

C:\Users\Rafael\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, dialect, tupleize_cols, error_bad_lines, warn_bad_lines, skipfooter, skip_footer, doublequote, delim_whitespace, as_recarray, compact_ints, use_unsigned, low_memory, buffer_lines, memory_map, float_precision)
    644                     skip_blank_lines=skip_blank_lines)
    645 
--> 646         return _read(filepath_or_buffer, kwds)
    647 
    648     parser_f.__name__ = name

C:\Users\Rafael\Anaconda3\lib\site-packages\pandas\io\parsers.py in
_read(filepath_or_buffer, kwds)
    399         return parser
    400 
--> 401     data = parser.read()
    402     parser.close()
    403     return data

C:\Users\Rafael\Anaconda3\lib\site-packages\pandas\io\parsers.py in read(self, nrows)
    937                 raise ValueError('skipfooter not supported for iteration')
    938 
--> 939         ret = self._engine.read(nrows)
    940 
    941         if self.options.get('as_recarray'):

C:\Users\Rafael\Anaconda3\lib\site-packages\pandas\io\parsers.py in read(self, nrows)    1506     def read(self, nrows=None):    1507      try:
-> 1508             data = self._reader.read(nrows)    1509         except StopIteration:    1510             if self._first_chunk:

pandas\parser.pyx in pandas.parser.TextReader.read (pandas\parser.c:10415)()

pandas\parser.pyx in pandas.parser.TextReader._read_low_memory (pandas\parser.c:10691)()

pandas\parser.pyx in pandas.parser.TextReader._read_rows (pandas\parser.c:11437)()

pandas\parser.pyx in pandas.parser.TextReader._tokenize_rows (pandas\parser.c:11308)()

pandas\parser.pyx in pandas.parser.raise_parser_error (pandas\parser.c:27037)()

CParserError: Error tokenizing data. C error: Expected 2 fields in line 340, saw 3**

0 个答案:

没有答案