|
50 | 50 | pandas_dtype, |
51 | 51 | ) |
52 | 52 | from pandas.core.dtypes.dtypes import DatetimeTZDtype |
53 | | -from pandas.core.dtypes.generic import ( |
54 | | - ABCDataFrame, |
55 | | - ABCIndex, |
56 | | - ABCSeries, |
57 | | -) |
58 | 53 | from pandas.core.dtypes.missing import isna |
59 | 54 |
|
60 | 55 | from pandas.core import ( |
61 | 56 | algorithms as algos, |
62 | | - arraylike, |
63 | 57 | missing, |
64 | 58 | ops, |
65 | 59 | roperator, |
@@ -758,39 +752,6 @@ def __array__( |
758 | 752 |
|
759 | 753 | return self.to_numpy(dtype=dtype, copy=copy) |
760 | 754 |
|
761 | | - def __array_ufunc__(self, ufunc: np.ufunc, method: str, *inputs, **kwargs): |
762 | | - if any( |
763 | | - isinstance(other, (ABCSeries, ABCIndex, ABCDataFrame)) for other in inputs |
764 | | - ): |
765 | | - return NotImplemented |
766 | | - |
767 | | - result = arraylike.maybe_dispatch_ufunc_to_dunder_op( |
768 | | - self, ufunc, method, *inputs, **kwargs |
769 | | - ) |
770 | | - if result is not NotImplemented: |
771 | | - return result |
772 | | - |
773 | | - if "out" in kwargs: |
774 | | - return arraylike.dispatch_ufunc_with_out( |
775 | | - self, ufunc, method, *inputs, **kwargs |
776 | | - ) |
777 | | - |
778 | | - if method == "reduce": |
779 | | - result = arraylike.dispatch_reduction_ufunc( |
780 | | - self, ufunc, method, *inputs, **kwargs |
781 | | - ) |
782 | | - if result is not NotImplemented: |
783 | | - return result |
784 | | - |
785 | | - if self.dtype.kind == "f": |
786 | | - # e.g. test_log_arrow_backed_missing_value |
787 | | - new_inputs = [ |
788 | | - x if x is not self else x.to_numpy(na_value=np.nan) for x in inputs |
789 | | - ] |
790 | | - return getattr(ufunc, method)(*new_inputs, **kwargs) |
791 | | - |
792 | | - return arraylike.default_array_ufunc(self, ufunc, method, *inputs, **kwargs) |
793 | | - |
794 | 755 | def __invert__(self) -> Self: |
795 | 756 | # This is a bit wise op for integer types |
796 | 757 | if pa.types.is_integer(self._pa_array.type): |
|
0 commit comments