0

I have a txt file that I open in Excel that has merged cells (see image).

enter image description here.

These cause an error message when reading the file:

CParserError: Error tokenizing data. C error: Expected 1 fields in line 1883, saw 2

At the moment I'm manually taking them out in Excel. I'm sure there could be a way to taken these out when reading a file but I can't find anything on SO. I'm not sure if I'm using the right terminology though.

Using Excel may also be an option. I just wanted to see if there was a method using Python.

Community
  • 1
  • 1

1 Answers1

0

If you just want to skip the headers, you might look at this SO answer which suggests the following:

data = pd.read_csv('file1.csv', error_bad_lines=False)
Richard Inglis
  • 5,888
  • 2
  • 33
  • 37