df = pd.read_csv(io.BytesIO(uploaded['data.csv']))
ParserError Traceback (most recent call last)
<ipython-input-22-a523fd2e8c08> in <module>()
1 import io
2
----> 3 df = pd.read_csv(io.BytesIO(uploaded['data.csv']))
4
5
3 frames
/usr/local/lib/python3.7/dist-packages/pandas/io/parsers.py in read(self, nrows)
2155 def read(self, nrows=None):
2156 try:
-> 2157 data = self._reader.read(nrows)
2158 except StopIteration:
2159 if self._first_chunk:
pandas/_libs/parsers.pyx in pandas._libs.parsers.TextReader.read()
pandas/_libs/parsers.pyx in pandas._libs.parsers.TextReader._read_low_memory()
pandas/_libs/parsers.pyx in pandas._libs.parsers.TextReader._read_rows()
pandas/_libs/parsers.pyx in pandas._libs.parsers.TextReader._tokenize_rows()
pandas/_libs/parsers.pyx in pandas._libs.parsers.raise_parser_error()
ParserError: Error tokenizing data. C error: Expected 3 fields in line 77, saw 5
Asked
Active
Viewed 1,950 times
0
1 Answers
0
import pandas as pd #import pandas
fread = pd.read_csv('filepath/filename.csv') #make fread as object
freaddf = pd.DataFrame(fread, columns=['col1name', 'col2name', 'col3name'])
print(freaddf.to_string())
-
Can you add some more useful explanation or make your comments more helpful? The `#import pandas` comment really doesn't tell me anything that the code doesn't tell me, for example. – General Grievance Sep 13 '21 at 12:05