Consider the example from the Reshaping and pivoting section. Say you want to transform the index terms to capital letters:
dframe1.index = dframe1.index.map(str.upper)
dframe1
The output of the preceding code is as follows:
Note that the indexes have been capitalized. If we want to create a transformed version of the dataframe, then we can use the rename() method. This method is handy when we do not want to modify the original data. Check the following example:
dframe1.rename(index=str.title, columns=str.upper)
And the output of the code is as follows:
The rename method does not make a copy of the dataframe.