# Demographic Data Analyzer Challenger - highest percentage of people that earn >50K

Hi,

I am having trouble understanding why the expected outcome of the question is Iran :

``````What country has the highest percentage of people that earn >50K and what is that percentage?

``````

If I run the following code :

``````highest_earning_country = df['native-country'][df['salary'] == '>50K'].value_counts()

``````

We can see that the country with higher number of people earning >50k is the USA , however the expected outcome would be Iran. I don’t get it ?

``````United-States         7171
?                      146
Philippines             61
Germany                 44
India                   40
Mexico                  33
England                 30
Cuba                    25
Italy                   25
Japan                   24
China                   20
Taiwan                  20
Iran                    18
South                   16
France                  12
Puerto-Rico             12
Poland                  12
Jamaica                 10
Greece                   8
Cambodia                 7
Hong                     6
Yugoslavia               6
Ireland                  5
Vietnam                  5
Haiti                    4
Portugal                 4
Thailand                 3
Guatemala                3
Hungary                  3
Scotland                 3
Columbia                 2
Laos                     2
Peru                     2
Dominican-Republic       2
Nicaragua                2
Honduras                 1
Name: native-country, dtype: int64
``````

It’s the percent of people with salary >50K to people with all salaries.

1 Like

Ye, but that doesnt make Iran with the highest % of people earning >50K.

What are total numbers of people in dataset per country?

1 Like

Except it does?
You want percenteger “per country” not “overall”. Like, if a country had only one person and that person earned “>50k” then that country would have 100% and be the highest percentage.

1 Like

Ok guys, thanks.

Now I know what I got wrong, I wasn’t getting the value of the total number of people per country.

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