What country has the highest percentage of people that earn >50K?

Hi,

I’m having an issue getting the average age of men and the country with the highest number of people earning above 50K. Kindly see my project link below. What am I doing wrongly?

https://replit.com/@Beejay4L

Thanks

Please provide a direct link to the project, not just your replit.
That said, going into the demographic project, the vast majority of tasks are empty. So that doesn’t seem right.

Also your questions refer to wildly different tasks. Whereas the percentage per country are very complex, getting the average for a column based on one condition shouldn’t be a problem… Unless ofcourse you forgot to look at the data to see it’s capitalized “Male” while your condition looks for “male” :wink:

You might want to download the data and have a personal file to explore the data and try out different transformation, which might help you get to the people-above-50K issue as well.

Hello Jagaya,

Please find below. The question is what country has the highest percentage of people that earn above 50%

boilerplate-demographic-data-analyzer-1 - Replit

For a start, please maintain code without errors. Right now all I get is a syntax error because of this line

highest_earning_country = (df[df['salary' == '50K']['native-country'].value_counts()                           / ['native-country'].value_counts()])*100

So please try fixing the error. Also you have to include df every time you access it’s values - you cannot just throw a ['native-country'] in there and assume Pyhton knows this is supposed to belong to df.

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