Answers for "repace a particular vaue in column pandas dataframe"

4

pandas replace data in specific columns with specific values

### replace one value ###
df["column"].replace("US","UK") # you can also use numerical values
### replace more than one value ###
df["column"].replace(["man","woman","child"],[1,2,3]) # you can also use numerical values
#   man ==> 1
# woman ==> 2
# child ==> 3
Posted by: Guest on September-22-2021
3

python - show repeted values in a column

df = df[df.duplicated(subset=['val1','val2'], keep=False)]
Posted by: Guest on September-08-2020

Code answers related to "repace a particular vaue in column pandas dataframe"

Python Answers by Framework

Browse Popular Code Answers by Language