Error in Reading a csv file in pandas[CParserError: Error tokenizing data. C error: Buffer overflow caught – possible malformed input file.]

I found this error, the cause was that there were some carriage returns “\r” in the data that pandas was using as a line terminator as if it was “\n”. I thought I’d post here as that might be a common reason this error might come up.

The solution I found was to add lineterminator=’\n’ into the read_csv function like this:

df_clean = pd.read_csv('test_error.csv',
                 lineterminator='\n')

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)