pandas generate new column index code example Example: set index in datarame df = df.set_index('col')