The column outcome_type in my data frame (far right in image) contains 9 categories of what happens to animals at a shelter (adoption, died, transferred, etc). I am trying to change those categories to be 1 for Adoption and 0 for all other categories. I tried to do so using this for loop, but when I print the df afterward, the categories are still there and have not been replaced with 0 and 1. Can anyone tell me why?
import pandas as pd
df = pd.read_csv('aac_shelter_outcomes.csv')
df.head()
for item in df['outcome_type']:
if item == "Adoption":
item = int('1')
else: item = int('0')
EDIT: I realize there may be another way to do this that someone already discovered in another question, but I would like to know WHY my for loop approach does not work. (I am a beginner with python and am looking to learn from this. I can't see why the for loop doesn't change the df values.)