I want to fill in the missing values of two columns with the mean method. I type of the two columns is float64.
df['col1'].dtypes
dtype('float64')
df['col2'].dtypes
dtype('float64')
I used two methods to fill the columns. 1st I fill the nan values with '0'.
df.replace(np.nan,0, inplace=True )
Then I used fillna.mean() method to fill the columns
df['col1']=df['col1'].fillna(df['col1'].mean(), inplace=True)
This is return something like that
Col1
Nan
Nan
Nan
I tried second method without first filling the nan values with zero and directly applied mean imputation method which return "None".
I did not understand what was wrong with my implementation. Any help would be appreciated.