consider the pd.DataFrame
df
df = pd.DataFrame([
[np.nan, 1, np.nan],
[2, np.nan, np.nan],
[np.nan, np.nan, 3 ],
], list('abc'), list('xyz'))
df
and the pd.Series
s
s = pd.Series([10, 20, 30], list('abc'))
How do I fill in missing values of df
with the corresponding values of s
based on the index of s
and the index of df
For example:
df.loc['c', 'x']
isNaN
s.loc['c']
is30