How to set “Unnamed: 0” column as the index in a DataFrame

pd.read_csv('file.csv', index_col=[0])

Here is what the above code is Doing:
1. We’re reading the file.csv file and storing it in a variable called df.
2. We’re telling pandas to use the first column as the index.
3. We’re telling pandas to use the first row as the column names.