Demographic Data Analytic - 'NoneType' object is not subscriptable

I am finishing my demographic data analytic project, my code works fine and the results are accurate but it keeps showing errors and warnings in the last lines. I rechecked my code a lot of time and other similar tutorials & solutions’ work fine too.

Type error is: ‘NoneType’ object is not subscriptable, which is an error in the test_module.py file (the pre-available file) instead of my code.

Before this, there was another warning “Boolean Series key will be reindexed to match DataFrame index” along my code, but after I changed my boolean series to boolean arrays, this warning was gone but came the type error.

I’ve been trying to look into this for the past 4 hours and would REALLY appreciate some help! Thanks a lot!

What’s your code? Without seeing it, the help can only be a guess.

Hi sanity, my code is a bit long, so I’ll attach the link to the project:

demographic data analyzer - code

Notice the part that contains return statement got indented at the same level as the block below if print_data:. As python uses indentation to group which code belongs where, currently function will return dictionary with answers only when print_data evaluates to True.

Thank you so much, I fixed it!

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