Data Analysis with Python Projects - Demographic Data Analyzer

KeyErrors despite correct answers.
Describe your issue in detail here.
Hi, I have a search about fixing keyErrors messages but probably need some hint to why such errors would arise, even though they are not failing the test. thank you for any help in advance.
Your code so far

 python
Number of each race:
 White                 27816
Black                  3124
Asian-Pac-Islander     1039
Amer-Indian-Eskimo      311
Other                   271
Name: race, dtype: int64
Average age of men: 39.4
pcage with Bachelors degrees: 16.4%
pcage with higher education that earn >50K: 46.5%
pcage without higher education that earn >50K: 17.4%
Min work time: 1 hours/week
pcage of rich among those who work fewest hours: 10.0%
Country with highest pcage of rich: Iran
Highest pcage of rich people in country: 41.9%
Top occupations in India: Prof-specialty
ERROR: test_highest_earning_country_percentage (test_module.DemographicAnalyzerTestCase)
Traceback (most recent call last):
  File "/home/runner/boilerplate-demographic-data-analyzer/", line 50, in test_highest_earning_country_percentage
    actual =['highest_earning_country_percentage']
KeyError: 'highest_earning_country_percentage'

ERROR: test_percentage_bachelors (test_module.DemographicAnalyzerTestCase)
Traceback (most recent call last):
  File "/home/runner/boilerplate-demographic-data-analyzer/", line 20, in test_percentage_bachelors
    actual =['percentage_bachelors']
KeyError: 'percentage_bachelors'

ERROR: test_rich_percentage (test_module.DemographicAnalyzerTestCase)
Traceback (most recent call last):
  File "/home/runner/boilerplate-demographic-data-analyzer/", line 40, in test_rich_percentage
    actual =['rich_percentage']
KeyError: 'rich_percentage'

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/ Safari/537.36 Edg/107.0.1418.56

Challenge: Data Analysis with Python Projects - Demographic Data Analyzer

Link to the challenge:

Please format your message properly.
This is how you can format.

Could you also provide a link to your code? - boilerplate-demographic-data-analyzer - Replit

thank you

The link at the bottom doesn’t work for us, there’s no code

Hi, I have already figure out the error after having no reply. thank you!

If you have the same error, look at those key error labels, those labels in the py file for working on are not matching the test.

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