pandas replace data in specific columns with specific values

Solutions on MaxInterview for pandas replace data in specific columns with specific values by the best coders in the world

we are a community of more than 2 million smartest coders
registration for
employee referral programs
are now open
get referred to google, amazon, flipkart and more
register now
  
pinned-register now
showing results for - "pandas replace data in specific columns with specific values"
Amelie
31 Jul 2017
1### replace one value ###
2df["column"].replace("US","UK") # you can also use numerical values
3### replace more than one value ###
4df["column"].replace(["man","woman","child"],[1,2,3]) # you can also use numerical values
5#   man ==> 1
6# woman ==> 2
7# child ==> 3