I have a dataframe with missing values for some columns:
a = pd.DataFrame(data = {"name":['bob','sue','dave'],'status':[np.NaN,np.NaN,'A'],'team':['red','blue',np.NaN]},index=[100,101,105])
Dataframe a
I have another dataframe with the same index where some of the missing values have been replaced:
b = pd.DataFrame(data = {"name":['bob','sue','dave'],'status':['I','O','A'],'team':['red','blue',np.NaN]},index=[100,101,105])
Dataframe b
Is there a way to map dataframe b to a so that the values for specific columns in a are replaced? There are lots of other rows in a that aren't in b so I only want to replace the rows that have the same index.
I tried this but it sets the values to np.NaN:
a['status'] = a['status'].map(b['status'])
a['team'] = a['team'].map(b['team'])
Dataframe a after mapping



a.combine_first(b)?