Skip to content
Advertisement

Set dictionary keys as cells in dataframe column

Please look at my code:

JavaScript

Here I convert dictionary to DataFrame and set index as new column.

JavaScript

Can it be done in 1 line at the stage of converting a dictionary to a date without

JavaScript

I want to immediately recognize the major indices as cells of the new column. Something like

JavaScript

Advertisement

Answer

You can just reset_index() to create a column from index and df.rename to change name of index column to new

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