Is there a python pandas method to rename contents of a DataFrame using dictionaries or otherwise?
I normally use rename method on index labels and column titles. But when dataframe entries are to be replaced using dictionaries I use set_index to make them index, then use rename method on index and later reset_index. I understand this is round-about.
Is there any other way this can be done using fewer lines of code?
example: Suppose below is my dataframe & I want to change acronyms under column title State with State Names i.w. CA - California, IL - Illinois etc
Rank State Metro CountyName
1 NY New York Queens
2 CA Los Angeles-Long Beach-Anaheim Los Angeles
3 IL Chicago Cook
4 PA Philadelphia Philadelphia
5 AZ Phoenix Maricopa
6 NV Las Vegas Clark
7 CA San Diego San Diego
8 TX Dallas-Fort Worth Dallas
9 CA San Jose Santa Clara