Please note, this is a STATIC archive of website www.w3resource.com from 19 Jul 2022, cach3.com does not collect or store any user information, there is no "phishing" involved.

Examples

In [31]:
import numpy as np
import pandas as pd
In [32]:
x = pd.Series([1, 1, 1, np.nan], index=['p', 'q', 'r', 's'])
x
Out[32]:
p    1.0
q    1.0
r    1.0
s    NaN
dtype: float64
In [33]:
y = pd.Series([1, np.nan, 1, np.nan], index=['p', 'q', 'r', 's'])
y
Out[33]:
p    1.0
q    NaN
r    1.0
s    NaN
dtype: float64
In [34]:
x.add(y, fill_value=0)
Out[34]:
p    2.0
q    1.0
r    2.0
s    NaN
dtype: float64