Table Of Contents

Search

Enter search terms or a module, class or function name.

pandas.Series.combine

Series.combine(other, func, fill_value=None)[source]

Perform elementwise binary operation on two Series using given function with optional fill value when an index is missing from one Series or the other

Parameters:
other : Series or scalar value

func : function

Function that takes two scalars as inputs and return a scalar

fill_value : scalar value

The default specifies to use the appropriate NaN value for the underlying dtype of the Series

Returns:
result : Series

See also

Series.combine_first
Combine Series values, choosing the calling Series’s values first

Examples

>>> s1 = pd.Series([1, 2])
>>> s2 = pd.Series([0, 3])
>>> s1.combine(s2, lambda x1, x2: x1 if x1 < x2 else x2)
0    0
1    2
dtype: int64
Scroll To Top