I have a problem trying to replicate "Handling Missing Values with Imputation" in jupyter

Hi i am trying to replicate this exercise in jupyter
https://app.dataquest.io/m/347/working-with-missing-and-duplicate-data/11/handling-missing-values-with-imputation.

The code is the same that has worked on the platform:

I am using the same code in jupyter but is showing this error

AttributeError: ‘numpy.int64’ object has no attribute ‘fillna’

when i look at the type of element “combined[“HAPPINESS SCORE UPDATED”]” jupyter says is a <class ‘numpy.int64’> but it should be a dataframe right? i also tried to change it using pd.DataFrame() but is not working.

Can anyone help me please?

Hi! Could you share the whole notebook, please? As for me, the problem should be in some previous cell.

FileToDataquest.ipynb (21.8 KB)

Sure I am uploading it , i also uploaded the file of regionss.csv in case you need it. Thanks for your help.
regionss.csv (5.2 KB)

Click here to view the jupyter notebook file in a new tab

Yep, check the cell no. 11:

combined=combined.isnull().sum()

You transform you dataframe: now all the columns don´t contain series, just a number which corresponds to the number of missing values in a column. Probably you meant to put missing = combined.isnull().sum() . Am I right?

You are rigth! :smiley: thanks a lot! :smiley:

Welcome! If you consider your question answered, please, mark the solution, it’ll help others to find the solution faster, if they face similar problem😀