I have a dataframe
in pandas
like this small example:
small example:
0 1 2 3 4 5 6
Probe IRF2 PTEN PRKACB BBS1 PPARGC1B ITGAE
20190606_CF 231.14 115.57 180.02 155.57 408.94 164.46
20190606_CF 340.19 240.4 396.13 133.05 142.12 247.96
I want to remove the 1st row and put the 2nd row as header. and in fact the 3rd row (of small example) would be the first row of data. here is the expected output:
Probe IRF2 PTEN PRKACB BBS1 PPARGC1B ITGAE
20190606_CF 231.14 115.57 180.02 155.57 408.94 164.46
20190606_CF 340.19 240.4 396.13 133.05 142.12 247.96
I am trying to do that in pandas using this code:
new = df.rename(columns=df.iloc[0])
but it does not return the expected output. do you know how to fix it?