Can anyone help me figure out why this isn\'t working:
ages = [\'15-19\',\'20-24\',\'25-29\',\'30-34\',\'35-39\',\'40-44\',\'45-49\',\'50-54\',\'55-59\',\'60
Your "range" is not correct, try:
ages = ['15-19','20-24','25-29','30-34','35-39','40-44','45-49','50-54','55-59','60-64','65-69','70-74','75-79','80-84'] race['age_group'] = pd.cut(race.Age,range(15,86,5),right=False, labels=ages) race[['Age','age_group']].head(15)