Reputation: 596
I want to import excel sheets as data frames and export as csv. I need to do this for quite a few files. However, the headers of all files are arranged in two rows.
Thus, when I read the files, I get the headers as Fuel Temp \n(Deg C)
,Air Charge Temp \n(Deg C)
and so on.
How do I read these files into dataframes without the '\n'?
Upvotes: 3
Views: 174
Reputation: 862396
I believe you need str.replace
:
df.columns = df.columns.str.replace('\n', '')
Upvotes: 3