Tell us what’s happening:
I am getting the result as United States with a percent of 91.4 - which is the incorrect answer.
Your code so far
What country has the highest percentage of people that earn >50K?
totalcount=df[df['salary']=='>50K'].count().iloc[0]
df1 = df[df['salary']=='>50K'].groupby('native-country',as_index=False).size()
df1.columns=['country','50Kcount']
df1['percentcount']=df1['50Kcount']/totalcount*100
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: