user15240243
user15240243

Reputation: 27

Delete rows above headers in a CSV using Python Pandas

I need to clean up a files using Pandas. But the raw files we are using have a couple of rows above the column headers that I need to erase before getting to work. I do not find how to get rid of them.

I suppose this has to be done before generating the frame.

Can someone help?

Thanks in advance.

Sample CSV raw file

Upvotes: 1

Views: 1148

Answers (1)

tlentali
tlentali

Reputation: 3455

You can try using the skiprows parameter in read_csv() :

pd.read_csv('filename.csv', skiprows=5)

Upvotes: 1

Related Questions