Pandas reset_index: Turning a data frame’s index into a column

Pandas reset_index: Turning a data frame's index into a column

Return a Python Pandas data frame’s index to a regular column with reset_index:

df = df.reset_index()

• 1-column index? It’s now a regular column.
• Multi-index? Its columns are all regular columns.

reset_index returns a new data frame. It doesn’t modify the original.