I'm trying to fill in the nan
values inside my dataframe with the mean of each column, but I found out that the df.fillna()
function is returning the same dataframe because there mean function returns an empty series whenever I call the function like so: df.fillna(df.mean())
. I'm having the same issue with df.std()
, but df.sum
works. Am i missing something or formatting my dataframe incorrectly?
Asked
Active
Viewed 16 times
0

SafeDev
- 641
- 4
- 12
-
1Problem is `NaN`s are strings, not numeric, so solution is converting columns to numeric. – jezrael Mar 22 '20 at 14:16
-
According to the pandas documentation they were just able to use np.nan and replace it. So i don't understand why it doesn't work the same. https://pandas.pydata.org/pandas-docs/stable/user_guide/missing_data.html – SafeDev Mar 22 '20 at 14:38
-
yes, you can do it. But first convert values to numeric. – jezrael Mar 22 '20 at 14:39