嗨,我有很多csv文件,并希望将它们放入一个大的df
tmp = []
for file in directory_liste:
df_x = pd.read_csv(file)
tmp.append(df_x)
df = pd.concat(tmp)
我收到此错误
ParserError: Error tokenizing data. C error: Expected 2 fields in line 3, saw 3
我真的不知道该如何解决
这是完整的错误报告
ParserError Traceback (most recent call last)
<ipython-input-14-c8e42d981b3a> in <module>
3
4 for file in directory_liste:
----> 5 df_x = pd.read_csv(file)
6 tmp.append(df_x)
7
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, skipfooter, 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, doublequote, escapechar, comment, encoding, dialect, tupleize_cols, error_bad_lines, warn_bad_lines, delim_whitespace, low_memory, memory_map, float_precision)
700 skip_blank_lines=skip_blank_lines)
701
--> 702 return _read(filepath_or_buffer, kwds)
703
704 parser_f.__name__ = name
C:\ProgramData\Anaconda3\lib\site-packages\pandas\io\parsers.py in _read(filepath_or_buffer, kwds)
433
434 try:
--> 435 data = parser.read(nrows)
436 finally:
437 parser.close()