I have a data frame with many columns, say:
df:
name salary age title
John 100 35 eng
Bill 200 NaN adm
Lena NaN 28 NaN
Jane
According to Pandas documentation in 23.3
values = {'salary': -1, 'age': -1}
df = df.fillna(value=values)
Try this:
df.loc[:, ['salary', 'age']].fillna(-1, inplace=True)
It is not so beautiful, but it works:
df.salary.fillna(-1, inplace=True)
df.age.fillna(-1, inplace=True)
df
>>> name salary age title
0 John 101.0 35.0 eng
1 Bill 200.0 -1.0 adm
2 Lena -1.0 28.0 NaN
3 Jane 120.0 45.0 eng