How to rename the columns of a DataFrame
• 1 minThere is the .columns attribute given by the Pandas library that will give you the current columns of a DataFrame.
You might end up needing to change them.
To do so, you will need to assign a list of new column names to the DataFrame.columns as so:
Be careful to match the correct number of columns that your DataFrame currently have or you will run into an error.
Renaming the index column
In order to rename the index column you will assign a new value to the index.name attribute as so:
Here you are ! You know how to rename both columns and index columns of a DataFrame.