How to rename columns in Pandas DataFrame

df.rename(columns={'oldName1': 'newName1',
                   'oldName2': 'newName2'},
          inplace=True, errors='raise')
# Make sure you set inplace to True if you want the change
# to be applied to the dataframe

Here is what the above code is Doing:
1. Rename the column oldName1 to newName1.
2. Rename the column oldName2 to newName2.
3. Set the inplace parameter to True to apply the changes to the dataframe.
4. Set the errors parameter to ‘raise’ to raise an error if a column is not found in the dataframe.