How to add an Index, row, or column to a Pandas DataFrame? code example
Example 1: pandas create a column from index
df.reset_index(level=0, inplace=True)
Example 2: set index in datarame
df = df.set_index('col')
df.reset_index(level=0, inplace=True)
df = df.set_index('col')