ParserError, cannot load my tsv and csv files

  Kiến thức lập trình

Read apps.tsv and user_history.tsv with error_bad_lines parameter

apps = pd.read_csv('./input_data/apps.tsv', delimiter='t', encoding='utf-8',on_bad_lines='skip')
user_history = pd.read_csv('./input_data/user_history.tsv', delimiter='t',lineterminator='n', encoding='utf-8',on_bad_lines='skip')

Read jobs.tsv without specifying error_bad_lines parameter

jobs = pd.read_csv('./input_data/jobs/jobs.tsv', delimiter='t', encoding='utf-8')

Read users.tsv and test_users.tsv without specifying error_bad_lines parameter

users = pd.read_csv('./input_data/users.tsv', delimiter='t', encoding='utf-8')
test_users = pd.read_csv('./input_data/test_users.tsv', delimiter='t', encoding='utf-8')

error ::::

---------------------------------------------------------------------------
ParserError                               Traceback (most recent call last)
Cell In[48], line 6
      3 user_history = pd.read_csv('./input_data/user_history.tsv', delimiter='t',lineterminator='n', encoding='utf-8',on_bad_lines='skip')
      5 # Read jobs.tsv without specifying error_bad_lines parameter
----> 6 jobs = pd.read_csv('./input_data/jobs/jobs.tsv', delimiter='t', encoding='utf-8')
      8 # Read users.tsv and test_users.tsv without specifying error_bad_lines parameter
      9 users = pd.read_csv('./input_data/users.tsv', delimiter='t', encoding='utf-8')

File ~AppDataLocalPackagesPythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0LocalCachelocal-packagesPython311site-packagespandasioparsersreaders.py:1026, in read_csv(filepath_or_buffer, sep, delimiter, header, names, index_col, usecols, 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, date_format, dayfirst, cache_dates, iterator, chunksize, compression, thousands, decimal, lineterminator, quotechar, quoting, doublequote, escapechar, comment, encoding, encoding_errors, dialect, on_bad_lines, delim_whitespace, low_memory, memory_map, float_precision, storage_options, dtype_backend)
   1013 kwds_defaults = _refine_defaults_read(
   1014     dialect,
   1015     delimiter,
   (...)
   1022     dtype_backend=dtype_backend,
   1023 )
   1024 kwds.update(kwds_defaults)
-> 1026 return _read(filepath_or_buffer, kwds)

File ~AppDataLocalPackagesPythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0LocalCachelocal-packagesPython311site-packagespandasioparsersreaders.py:626, in _read(filepath_or_buffer, kwds)
    623     return parser
    625 with parser:
--> 626     return parser.read(nrows)

File ~AppDataLocalPackagesPythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0LocalCachelocal-packagesPython311site-packagespandasioparsersreaders.py:1923, in TextFileReader.read(self, nrows)
...

File parsers.pyx:2061, in pandas._libs.parsers.raise_parser_error()

ParserError: Error tokenizing data. C error: Expected 11 fields in line 122433, saw 12
Output is truncated. View as a scrollable element or open in a text editor. Adjust cell output settings...

i want this error to be gone and load my tsv csv files

New contributor

sumayya abdul salam is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

LEAVE A COMMENT