Hello!
I am stuck while running my code below. I would really appreciate your help in detailing what the problem could be?
Thanks
Wole
Screen Link: https://app.dataquest.io/m/348/guided-project%3A-clean-and-analyze-employee-exit-surveys/11/next-steps
My Code: <def employee_retirement_age(age):
if age >= 50:
return ‘Old Age’
elif 40 <= age < 50:
return ‘Middle Age Adult’
elif 20 <= age < 40:
return ‘Young Adult’
elif pd.isnull(age):
return np.nan
else:
return ‘Young Adolescent’
combined_age_updated[‘Age_retirement_cat’] = combined_age_updated[‘age’].apply(employee_retirement_age)
Check the unique values after the updates
combined_age_updated[‘Age_retirement_cat’].value_counts()>
What I expected to happen: I expect my code to aggregate my data based on age column
What actually happened:
TypeError: '>=' not supported between instances of 'str' and 'int
<I tried runing my code but it shows the above error, What could be the problem?>