set index column pandas when creating dataframe code example Example: set index in datarame df = df.set_index('col')