(self, other, op, *, level=None, fill_value=None, axis: Axis = 0)
| 6854 | return out |
| 6855 | |
| 6856 | def _flex_method(self, other, op, *, level=None, fill_value=None, axis: Axis = 0): |
| 6857 | if axis is not None: |
| 6858 | self._get_axis_number(axis) |
| 6859 | |
| 6860 | res_name = ops.get_op_result_name(self, other) |
| 6861 | |
| 6862 | if isinstance(other, Series): |
| 6863 | return self._binop(other, op, level=level, fill_value=fill_value) |
| 6864 | elif isinstance(other, (np.ndarray, list, tuple, ExtensionArray)): |
| 6865 | if len(other) != len(self): |
| 6866 | raise ValueError("Lengths must be equal") |
| 6867 | other = self._constructor(other, self.index, copy=False) |
| 6868 | result = self._binop(other, op, level=level, fill_value=fill_value) |
| 6869 | result._name = res_name |
| 6870 | return result |
| 6871 | elif isinstance(other, ABCDataFrame): |
| 6872 | # GH#46179 |
| 6873 | raise TypeError( |
| 6874 | f"Series.{op.__name__.strip('_')} does not support a DataFrame " |
| 6875 | f"`other`. Use df.{op.__name__.strip('_')}(ser) instead." |
| 6876 | ) |
| 6877 | else: |
| 6878 | if fill_value is not None: |
| 6879 | if isna(other): |
| 6880 | return op(self, fill_value) |
| 6881 | self = self.fillna(fill_value) |
| 6882 | |
| 6883 | return op(self, other) |
| 6884 | |
| 6885 | def eq( |
| 6886 | self, |
no test coverage detected