[ CSV file read ] >>> import pandas as pd >>> df1 = pd.read_csv('sample.csv') >>> df1 StdID Middle Final 0 S01 90 95 1 S02 82 83 2 S03 80 78 3 S04 78 75 4 S05 93 91 [ 'StdID' set index ] >>> df1.set_index('StdID', inplace=True) >>> df1 Middle Final StdID S01 90 95 S02 82 83 S03 80 78 S04 78 75 S05 93 91 * inplace=True option df1.set_index('StdID', inplace=True) => df1 = df1.set_index('StdID') [ ..