pyspark.pandas.Series.add#

Series.add(other, fill_value=None)[source]#

Return Addition of series and other, element-wise (binary operator +).

Equivalent to series + other

Parameters
otherSeries or scalar value
fill_valueScalar value, default None
Returns
Series

The result of the operation.

See also

Series.radd

Examples

>>> df = ps.DataFrame({'a': [2, 2, 4, np.nan],
...                    'b': [2, np.nan, 2, np.nan]},
...                   index=['a', 'b', 'c', 'd'], columns=['a', 'b'])
>>> df
     a    b
a  2.0  2.0
b  2.0  NaN
c  4.0  2.0
d  NaN  NaN
>>> df.a.add(df.b)
a    4.0
b    NaN
c    6.0
d    NaN
dtype: float64
>>> df.a.radd(df.b)
a    4.0
b    NaN
c    6.0
d    NaN
dtype: float64