set index pandas series code example
Example 1: set index to column pandas
df = df.set_index('col')
df['col'] = df.index
Example 2: series change index pandas
x.index = index_values
df = df.set_index('col')
df['col'] = df.index
x.index = index_values