Q. What correction/modification would you suggest for the problem of the previous question which wanted to change the index and column name in the original data frame saleDf?


Answer :-

To change the index and columns' names in the original data frame, we must give argument inplace = True in the rename() method. Thus, the modified code of the previous question should be:


saleDf.rename (index = {'zoneC': 'Central', 'zoneD': 'Dakshin'}, columns = {'Target': 'Targeted', 'Sales': 'Achieved'}, inplace = True)
print(saleDf)

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post