jakevdp / PythonDataScienceHandbook

Python Data Science Handbook: full text in Jupyter Notebooks
http://jakevdp.github.io/PythonDataScienceHandbook
MIT License
43.16k stars 17.92k forks source link

I am new in Python Data Science. I have the error as follows: ParserError: Error tokenizing data. C error: Expected 1 fields in line 12, saw 2 . How to resolve this? #295

Open lesterchia1 opened 3 years ago

Kartik-Valluru commented 3 years ago

What were you trying to execute?

Bezdna7 commented 3 years ago

check correct data bro

coderSHeE commented 2 years ago

share your code ??

lesleyklassen commented 1 year ago

I'm following up with this 2 years later. Can anyone help me solve the same problem?

Code data_test = pd.read_csv('http://localhost:8889/edit/tourch-gpu/Datasets/IMDB/IMDB-test.csv

Error `--------------------------------------------------------------------------- ParserError Traceback (most recent call last) Cell In[21], line 1 ----> 1 data_test = pd.read_csv('http://localhost:8889/edit/tourch-gpu/Datasets/IMDB/IMDB-test.csv')

File ~/opt/anaconda3/envs/torch-gpu/lib/python3.9/site-packages/pandas/util/_decorators.py:211, in deprecate_kwarg.._deprecate_kwarg..wrapper(*args, *kwargs) 209 else: 210 kwargs[new_arg_name] = new_arg_value --> 211 return func(args, **kwargs)

File ~/opt/anaconda3/envs/torch-gpu/lib/python3.9/site-packages/pandas/util/_decorators.py:331, in deprecate_nonkeyword_arguments..decorate..wrapper(*args, *kwargs) 325 if len(args) > num_allow_args: 326 warnings.warn( 327 msg.format(arguments=_format_argument_list(allow_args)), 328 FutureWarning, 329 stacklevel=find_stack_level(), 330 ) --> 331 return func(args, **kwargs)

File ~/opt/anaconda3/envs/torch-gpu/lib/python3.9/site-packages/pandas/io/parsers/readers.py:950, in read_csv(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, cache_dates, iterator, chunksize, compression, thousands, decimal, lineterminator, quotechar, quoting, doublequote, escapechar, comment, encoding, encoding_errors, dialect, error_bad_lines, warn_bad_lines, on_bad_lines, delim_whitespace, low_memory, memory_map, float_precision, storage_options) 935 kwds_defaults = _refine_defaults_read( 936 dialect, 937 delimiter, (...) 946 defaults={"delimiter": ","}, 947 ) 948 kwds.update(kwds_defaults) --> 950 return _read(filepath_or_buffer, kwds)

File ~/opt/anaconda3/envs/torch-gpu/lib/python3.9/site-packages/pandas/io/parsers/readers.py:611, in _read(filepath_or_buffer, kwds) 608 return parser 610 with parser: --> 611 return parser.read(nrows)

File ~/opt/anaconda3/envs/torch-gpu/lib/python3.9/site-packages/pandas/io/parsers/readers.py:1778, in TextFileReader.read(self, nrows) 1771 nrows = validate_integer("nrows", nrows) 1772 try: 1773 # error: "ParserBase" has no attribute "read" 1774 ( 1775 index, 1776 columns, 1777 col_dict, -> 1778 ) = self._engine.read( # type: ignore[attr-defined] 1779 nrows 1780 ) 1781 except Exception: 1782 self.close()

File ~/opt/anaconda3/envs/torch-gpu/lib/python3.9/site-packages/pandas/io/parsers/c_parser_wrapper.py:230, in CParserWrapper.read(self, nrows) 228 try: 229 if self.low_memory: --> 230 chunks = self._reader.read_low_memory(nrows) 231 # destructive to chunks 232 data = _concatenate_chunks(chunks)

File ~/opt/anaconda3/envs/torch-gpu/lib/python3.9/site-packages/pandas/_libs/parsers.pyx:808, in pandas._libs.parsers.TextReader.read_low_memory()

File ~/opt/anaconda3/envs/torch-gpu/lib/python3.9/site-packages/pandas/_libs/parsers.pyx:866, in pandas._libs.parsers.TextReader._read_rows()

File ~/opt/anaconda3/envs/torch-gpu/lib/python3.9/site-packages/pandas/_libs/parsers.pyx:852, in pandas._libs.parsers.TextReader._tokenize_rows()

File ~/opt/anaconda3/envs/torch-gpu/lib/python3.9/site-packages/pandas/_libs/parsers.pyx:1973, in pandas._libs.parsers.raise_parser_error()

ParserError: Error tokenizing data. C error: Expected 1 fields in line 12, saw 2 `