-1

i have an excel file with merged header like this

my excel header

what i want is header like this using pandas

what i lookin for

I tried using this solution: https://stackoverflow.com/a/27424102/12934577

but it return sequence item 0: expected str instance, float found

mozway
  • 194,879
  • 13
  • 39
  • 75

1 Answers1

0

You might need to use str instead like in that answer:

df.columns = df.iloc[0:2].apply(lambda x: '.'.join([str(y) for y in x if y]), axis=0)
U13-Forward
  • 69,221
  • 14
  • 89
  • 114
  • thank you, but the NaN value below a,b and c (because it was merged) is still there it just transform too "_" – hughugy Oct 14 '21 at 11:40