MCPcopy
hub / github.com/pandas-dev/pandas / _binop

Method _binop

pandas/core/series.py:6779–6811  ·  view source on GitHub ↗

Perform generic binary operation with optional fill value. Parameters ---------- other : Series func : binary operator fill_value : float or object Value to substitute for NA/null values. If both Series are NA in a location, t

(self, other: Series, func, level=None, fill_value=None)

Source from the content-addressed store, hash-verified

6777 return left, right
6778
6779 def _binop(self, other: Series, func, level=None, fill_value=None) -> Series:
6780 """
6781 Perform generic binary operation with optional fill value.
6782
6783 Parameters
6784 ----------
6785 other : Series
6786 func : binary operator
6787 fill_value : float or object
6788 Value to substitute for NA/null values. If both Series are NA in a
6789 location, the result will be NA regardless of the passed fill value.
6790 level : int or level name, default None
6791 Broadcast across a level, matching Index values on the
6792 passed MultiIndex level.
6793
6794 Returns
6795 -------
6796 Series
6797 """
6798 this = self
6799
6800 if not self.index.equals(other.index):
6801 this, other = self.align(other, level=level, join="outer")
6802
6803 this_vals, other_vals = ops.fill_binop(this._values, other._values, fill_value)
6804
6805 with np.errstate(all="ignore"):
6806 result = func(this_vals, other_vals)
6807
6808 name = ops.get_op_result_name(self, other)
6809
6810 out = this._construct_result(result, name, other)
6811 return cast(Series, out)
6812
6813 def _construct_result(
6814 self,

Callers 1

_flex_methodMethod · 0.95

Calls 4

alignMethod · 0.80
funcFunction · 0.70
equalsMethod · 0.45
_construct_resultMethod · 0.45

Tested by

no test coverage detected