Demographic Data Analyzer

This is a Freecodecamp challenge, it looks like a simple step; need to get the output of the country’s name, im getting the percentage instead (froma series with two columns, the country and the percentage), still not able to display the name of the country so far…

  • What country has the highest percentage of people that earn >50K and what is that percentage?
totalbynat = df['native-country'].value_counts()
richbynat = df.loc[df['salary'] == '>50K']['native-country'].value_counts()
s = richbynat / totalbynat*100
s.max()

Your browser information:

User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.41 Safari/537.36 (Ecosia android@101.0.4951.41)

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