Tell us what’s happening:
I am getting the highest_earning_country to be USA instead of Iran as expected per Unit test module.
Your code so far
What country has the highest percentage of people that earn >50K?
df1 = df.groupby(['native-country','salary']).size().reset_index(name='count')
highest_earning_count=df1['count'].max().item()
highest_earning_country=df1[df1['count']==highest_earning_count]['native-country'].item()
highest_earning_country_percentage = highest_earning_count/df1['count'].sum()*100
highest_earning_country_percentage=highest_earning_country_percentage.round(decimals=1).item()
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1.2 Safari/605.1.15
.
Challenge: Demographic Data Analyzer
Link to the challenge: