pandas set column as index with name code example Example: dataframe names pandas print(df.rename(columns={'A': 'a', 'C': 'c'}))