I am trying to read a CSV file into pandas DataFrame. I have the data pattern on one of the rows on CSV as follows
a,b,\\"c\\,d",e,f,g,h --> read as 8 fields currently instead of the regular
a,b,c,e,f,g,h --> should be read as only 7 fields like the rest pattern on all other rows
When I use pd.read_csv('text.csv') to read into the DataFrame, I get the error
Error tokenizing data. C error: Expected 7 fields in line 36190, saw 8
Is there a way to read the data \"c\,d" into one column? Or what are the best practices to handle such cases in general?
Note: The letters on the rows mentioned above as part of the CSV file are just placeholders for the values in each line of CSV. They are not columns.
As suggest in the answers, this is what the data looks like at the moment on CSV file
AA BB CC DD EE FF GG HH 0 a b \"c\ d" e f g h 1 i j k l m n o 2 p q r s t u v and I want to read this into the DataFrame as follows and then get rid of quotes and backslashes
AA BB CC DD EE FF GG 0 a b \"c\d" e f g h 1 i j k l m n o 2 p q r s t u v
"With the data I have, only one row has [\"c\,d"] data pattern. Rest of them have one lesser field and are like any general comma-separated data. – Namesake", you need to add these things into your post and at least then have to place few lines of data into the post to reproduce it.