0

I am trying to work with a csv file and read it into a pandas dataframe. I need to use escapechar='\\' but i do not understand how it works. the code is:

import pandas as pd
df = pd.read_csv(filepath, escapechar='\\')

but i am getting an error:

ParserError: Error tokenizing data. C error: Expected 7 fields in line 23951, saw 8

I checked this record in the data frame, the only difference between this one and the rest of the records, which can be the cause of this problem, is one cell with the value:

groupe \Data Centre\""

in it, written in this exact syntax. is there a way to be able to read this df, without changing its values, and keep the use of escapechar='\\' ?
thank you very much.

Zusman
  • 606
  • 1
  • 7
  • 31

0 Answers0