Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

remove a column as index in dataframe

I have a df and I already used .pivot to creat the df. And now my df is same as this:

df that I have

I want to remove the ‘time_hour’ and create another df. I am using the reset_index and this is the results. However, I dont want a column with name time_hour. Could you please help me with that? Thanks
this is the df I want without the column time-hour

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Try df.rename_axis,

df = df.rename_axis(None, axis=1)  

‘time_hour’ is the column header axis name.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading