pandas.Series.combine¶
-
Series.
combine
(other, func, fill_value=nan)[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
Returns: result : Series
See also
Series.combine_first
- Combine Series values, choosing the calling Series’s values first
Examples
>>> s1 = Series([1, 2]) >>> s2 = Series([0, 3]) >>> s1.combine(s2, lambda x1, x2: x1 if x1 < x2 else x2) 0 0 1 2 dtype: int64