Higher_education_rich & lower_education_rich wronh values

I am calculating higher_education_rich by doing:
higher_education =df[df[“education”].isin([‘Bachelors’,‘Masters’,‘Doctorates’])]
higher_education_r = df[(df[“education”].isin([‘Bachelors’,‘Masters’,‘Doctorates’])) & (df[‘salary’]==’>50K’)]

higher_education_rich = round((len(higher_education_r)*100)/(len(higher_education)),1)

and I obtain a value of 44.9 , not the 46.5 expected.

And for the lower_education_rich I obtain 18.3, not 17.4 as expected… For this variable I am doing:
lower_education=df[~df[“education”].isin([‘Bachelors’,‘Masters’,‘Doctorates’])]
lower_education_rich = round(len(lower_education [lower_education.salary==’>50K’])*100/len(lower_education),1)

I can’t detect what I am doing wrong… Can you help me?

project link:

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36.

Challenge: Demographic Data Analyzer

Link to the challenge:

After a bit of trying myself, the error is REALLY simply but REALLY hard to find: It’s spelled “Doctorate” without “s” at the end.

Thanks a lot! It was driving me crazy haha
As you said, simply to solve but hard to detect!
Thanks again : )

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.