@@ -2057,54 +2057,12 @@ def empty(self) -> bool_t:
2057
2057
def __array__ (self , dtype : npt .DTypeLike | None = None ) -> np .ndarray :
2058
2058
return np .asarray (self ._values , dtype = dtype )
2059
2059
2060
- def __array_wrap__ (
2061
- self ,
2062
- result : np .ndarray ,
2063
- context : tuple [Callable , tuple [Any , ...], int ] | None = None ,
2064
- ):
2065
- """
2066
- Gets called after a ufunc and other functions.
2067
-
2068
- Parameters
2069
- ----------
2070
- result: np.ndarray
2071
- The result of the ufunc or other function called on the NumPy array
2072
- returned by __array__
2073
- context: tuple of (func, tuple, int)
2074
- This parameter is returned by ufuncs as a 3-element tuple: (name of the
2075
- ufunc, arguments of the ufunc, domain of the ufunc), but is not set by
2076
- other numpy functions.q
2077
-
2078
- Notes
2079
- -----
2080
- Series implements __array_ufunc_ so this not called for ufunc on Series.
2081
- """
2082
- res = lib .item_from_zerodim (result )
2083
- if is_scalar (res ):
2084
- # e.g. we get here with np.ptp(series)
2085
- # ptp also requires the item_from_zerodim
2086
- return res
2087
- d = self ._construct_axes_dict (self ._AXIS_ORDERS , copy = False )
2088
- # error: Argument 1 to "NDFrame" has incompatible type "ndarray";
2089
- # expected "BlockManager"
2090
- return self ._constructor (res , ** d ).__finalize__ ( # type: ignore[arg-type]
2091
- self , method = "__array_wrap__"
2092
- )
2093
-
2094
2060
@final
2095
2061
def __array_ufunc__ (
2096
2062
self , ufunc : np .ufunc , method : str , * inputs : Any , ** kwargs : Any
2097
2063
):
2098
2064
return arraylike .array_ufunc (self , ufunc , method , * inputs , ** kwargs )
2099
2065
2100
- # ideally we would define this to avoid the getattr checks, but
2101
- # is slower
2102
- # @property
2103
- # def __array_interface__(self):
2104
- # """ provide numpy array interface method """
2105
- # values = self.values
2106
- # return dict(typestr=values.dtype.str,shape=values.shape,data=values)
2107
-
2108
2066
# ----------------------------------------------------------------------
2109
2067
# Picklability
2110
2068
0 commit comments