Clean US Census Data

I am currently working the US Census - Cleaning data project and for some reason I am struggling with filling in the NaN values for the ‘Women’ population column. This is also preventing me fro being able to create the necessary graphs. Here is my code. Please help me with what I am doing wrong?

Here is a link to the project.
https://www.codecademy.com/courses/practical-data-cleaning/projects/data-cleaning-us-census

1 Like

Hi,
Working through this one myself and to get it to plot I had to do 2 things. First I’d suggest looking at your imports. Next and this one didn’t make sense to me but it’s how I got it to work: plt.scatter(us_census.Women, us_census.Income)

Maybe someone more knowledgeable can explain why it was necessary to input it that way, but for now I hope it helps.

You’ll get a plt error.

The matplotlib import is wrong in the lesson.
it said import matplotlib.pyplot as pyplot

change it to:
from matplotlib import pyplot as plt
or, import matplotlib.pyplot as plt

Hi! I’ve just started this project and I’m stuck at the very beginning, at 1) When it says ‘open the census files’ etc etc. How do I do this at the very beginning to see how many csv file are in the navigator? Before using glob.

Thanks! :slight_smile:

Click on the little folder (upper left) next to “script.py”

1 Like

Thanks!! I’m getting 2 errors. First, when I’m trying to do the scatter plot it shoot me that 'Women" is not defined, but if I print columns or type or the column itself it prints out without any problem. I already imported as import matplotlib.pyplot as plt (as your comment from before). Second, at the moment to check the duplicates and drop them I’m getting an error TypeError: unhashable type: ‘list’

Here is my code

I would love some kind of help as I’m stuck!
Thanks :slight_smile:

Hi,
Did you happen to research the errors yet?

A good place to start is the documentation for matplotlib and scatterplots.