Skip to content
Advertisement

df.drop does not work properly, pandas python

I have this excel file that I would like to “normalize” with the below code by dropping the A and B columns and then dropping the Rows 1,2,3,5 and making the row 4 as header.

enter image description here

JavaScript

But I keep getting this weird df that I dont understand the reason why

JavaScript

Also:

JavaScript

Advertisement

Answer

You must explicitely set the column names:

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement