在Jupyter Notebook中读取逗号分隔的值文件

时间:2018-11-05 06:08:51

标签: python pandas csv dataframe jupyter-notebook

在jupyter中读取此csv时出现错误。这是一个1MB的大文件,所以我不知道是否需要添加以下代码以外的其他内容。

import pandas as pd
df = pd.read_csv("C:/Users/okekec/Downloads/Week5-Visualization/Week5-Visualization/Indicators.csv")

> ParserError                               Traceback (most recent call
> last) <ipython-input-2-f86d364577b0> in <module>()
>       1 import pandas as pd
> ----> 2 df = pd.read_csv("C:/Users/okekec/Downloads/Week5-Visualization/Week5-Visualization/Indicators.csv")
> 
> ~\AppData\Local\Continuum\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)
>     653                     skip_blank_lines=skip_blank_lines)
>     654 
> --> 655         return _read(filepath_or_buffer, kwds)
>     656 
>     657     parser_f.__name__ = name
> 
> ~\AppData\Local\Continuum\anaconda3\lib\site-packages\pandas\io\parsers.py
> in _read(filepath_or_buffer, kwds)
>     409 
>     410     try:
> --> 411         data = parser.read(nrows)
>     412     finally:
>     413         parser.close()

0 个答案:

没有答案