I am reading a 8-column CSV file in the Pandas framework. The last column contains an error message, some of which contain commas. This causes the error reading the file.ParserError: Error tokenizing data. C error: Expected 8 fields in line 21922, saw 9
Is there a way to ignore all commas after the 8th field, instead of going through the file and removing the extra commas?
Code for reading a file:
import pandas as pd
df = pd.read_csv('C:\\somepath\\output.csv')
Line that works:
061AE,Active,001,2017_02_24 15_18_01,00006,1,00013,some message
Line Error:
061AE,Active,001,2017_02_24 15_18_01,00006,1,00013,longer message, with commas
source
share