I would like to replace the nan values from two columns in my dataframe with zero. I can do this for one column at a time, but not for the columns simultaneously. I would think this is something that is possible.
This is working:
train_data['AMT_REQ_CREDIT_BUREAU_YEAR'].fillna(0, inplace=True)
train_data['DAYS_LAST_PHONE_CHANGE'].fillna(0, inplace=True)
However, if I try this, there are no errors, but it is not replacing the nan values:
cols = ["AMT_REQ_CREDIT_BUREAU_YEAR","DAYS_LAST_PHONE_CHANGE"]
train_data[cols].replace(0, np.nan, inplace=True)
I have also tried:
train_data[cols].fillna(0, inplace=True)
without success.