The format of the CSV export might have changed
guillaume-chevalier opened this issue · comments
Error reportd by
Charles Ohana
:
https://www.linkedin.com/feed/update/urn:li:ugcPost:6657246873906216960?commentUrn=urn%3Ali%3Acomment%3A%28ugcPost%3A6657246873906216960%2C6729522924925136897%29
very interesting, looks like the instructions are outdated. The format of the export might have changed. I got the error below while trying to execute "df = pd.read_csv(f'{path}{file}')"
>>> df = pd.read_csv(f'{path}{file}')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib64/python3.7/site-packages/pandas/io/parsers.py", line 688, in read_csv
return _read(filepath_or_buffer, kwds)
File "/usr/local/lib64/python3.7/site-packages/pandas/io/parsers.py", line 460, in _read
data = parser.read(nrows)
File "/usr/local/lib64/python3.7/site-packages/pandas/io/parsers.py", line 1198, in read
ret = self._engine.read(nrows)
File "/usr/local/lib64/python3.7/site-packages/pandas/io/parsers.py", line 2157, in read
data = self._reader.read(nrows)
File "pandas/_libs/parsers.pyx", line 847, in pandas._libs.parsers.TextReader.read
File "pandas/_libs/parsers.pyx", line 862, in pandas._libs.parsers.TextReader._read_low_memory
File "pandas/_libs/parsers.pyx", line 918, in pandas._libs.parsers.TextReader._read_rows
File "pandas/_libs/parsers.pyx", line 905, in pandas._libs.parsers.TextReader._tokenize_rows
File "pandas/_libs/parsers.pyx", line 2042, in pandas._libs.parsers.raise_parser_error
pandas.errors.ParserError: Error tokenizing data. C error: Expected 1 fields in line 4, saw 6
Deleting first 3 info lines of Connections.csv on text editor
and adding this: df = pd.read_csv('Connections3.csv', error_bad_lines=False)
instead of: df = pd.read_csv('Connections1.csv')
And worked! Thank you Guillaume
@keremodabasi do you mean to delete the first three columns of the csv file? I am getting this error as well.
Removing the first three columns did the trick for me!