1

I am looking forward to turn df headers to the first row of my df:

     Air Unnamed:1 400.65 452.21 458.22 0    Wind       NaN   3835.83   3835.83   3813.18 1    Fire       NaN    989.05    989.75    981.31 2    Water      NaN   1617.00   1623.17   1614.64 

Looking for this output:

 0 1 2 3 4 0     Air NaN 400.65 452.21 458.22 1    Wind       NaN   3835.83   3835.83   3813.18 2    Fire       NaN    989.05    989.75    981.31 3    Water      NaN   1617.00   1623.17   1614.64 

I have tried setting the header of the read_html function to -1 to see if it could make the header into the first row such as:

pd.read_html(route, flavor='html5lib',header=-1) 

But didn't worked

Any idea on how to turn the headers into my first row of the df?

0

1 Answer 1

1

I think you need header=None:

pd.read_html(route, flavor='html5lib',header=None) 
Sign up to request clarification or add additional context in comments.

1 Comment

I thought that not considering the header parameter would act as header=None, however after inserting it , gave my desired output, Thank you!

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.