pd set column as index code example
Example 1: set index in datarame
df = df.set_index('col')
Example 2: how to change index in dataframe python
index = [1,2]
df.index = index
df = df.set_index('col')
index = [1,2]
df.index = index