Skip to content

Instantly share code, notes, and snippets.



Last active Sep 13, 2020
What would you like to do?
## where() to replace values
food_names_list = ["Cows' milk, whole", 'skim', 'Buttermilk, cultured']
boolean_idx = dairy_table["Food"].isin(food_names_list)
dairy_table['Food'].where(boolean_idx, other='Others')
index0 Cows' milk, whole
index1 skim
index2 Buttermilk, cultured
index3 Others
index4 Others
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment