I have a dataframe with nans in it:
>>>df.head()
Out[1]:
JPM US SMALLER COMPANIES C ACC
1990-01-02 NaN
1990
you need inplace
df[1].fillna(0, inplace=True)
You need to assign the value df = df.fillna( t )
You have two options:
1) Specific for each column
cols_fillna = ['column1','column2','column3']
# replace 'NaN' with zero in these columns
for col in cols_fillna:
df[col].fillna(0,inplace=True)
df[col].fillna(0,inplace=True)
2) For the entire dataframe
df = df.fillna(0)