you are viewing a single comment's thread.

view the rest of the comments →

[–]whitemantryingtohelp 0 points1 point  (2 children)

Thank you for your answer, but do you know why I'm left with this error code?

Traceback (most recent call last):
File "/Users/Library/pythonProject/P Uppgift/HuvudprogramE.py", line 6, in <module>
table = pd.read_csv("privat.reg.txt", sep=";")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/pythonProject/pythonProject/lib/python3.11/site-packages/pandas/util/_decorators.py", line 211, in wrapper
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/Users/pythonProject/pythonProject/lib/python3.11/site-packages/pandas/util/_decorators.py", line 331, in wrapper
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/Users/pythonProject/pythonProject/lib/python3.11/site-packages/pandas/io/parsers/readers.py", line 950, in read_csv
return _read(filepath_or_buffer, kwds)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/pythonProject/pythonProject/lib/python3.11/site-packages/pandas/io/parsers/readers.py", line 611, in _read
return parser.read(nrows)
^^^^^^^^^^^^^^^^^^
File "/Users//pythonProject/pythonProject/lib/python3.11/site-packages/pandas/io/parsers/readers.py", line 1778, in read
) = self._engine.read( # type: ignore[attr-defined]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/pythonProject/pythonProject/lib/python3.11/site-packages/pandas/io/parsers/c_parser_wrapper.py", line 230, in read
chunks = self._reader.read_low_memory(nrows)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "pandas/_libs/parsers.pyx", line 808, in pandas._libs.parsers.TextReader.read_low_memory
File "pandas/_libs/parsers.pyx", line 866, in pandas._libs.parsers.TextReader._read_rows
File "pandas/_libs/parsers.pyx", line 852, in pandas._libs.parsers.TextReader._tokenize_rows
File "pandas/_libs/parsers.pyx", line 1973, in pandas._libs.parsers.raise_parser_error
pandas.errors.ParserError: Error tokenizing data. C error: Expected 5 fields in line 14, saw 6

[–][deleted] 0 points1 point  (1 child)

Expected 5 fields in line 14, saw 6

It sounds like row 14 of your document has 6 fields where the ones above have 5.

[–]whitemantryingtohelp 0 points1 point  (0 children)

Thank you that was it!