@@ -378,23 +378,13 @@ def _prep_values(self, values: Optional[np.ndarray] = None) -> np.ndarray:
378378
379379 return values
380380
381- def _wrap_result (self , result , block = None , obj = None ) :
381+ def _wrap_result (self , result : np . ndarray ) -> "Series" :
382382 """
383- Wrap a single result.
383+ Wrap a single 1D result.
384384 """
385- if obj is None :
386- obj = self ._selected_obj
387- index = obj .index
385+ obj = self ._selected_obj
388386
389- if isinstance (result , np .ndarray ):
390-
391- if result .ndim == 1 :
392- from pandas import Series
393-
394- return Series (result , index , name = obj .name )
395-
396- return type (obj )(result , index = index , columns = block .columns )
397- return result
387+ return obj ._constructor (result , obj .index , name = obj .name )
398388
399389 def _insert_on_column (self , result : "DataFrame" , obj : "DataFrame" ):
400390 # if we have an 'on' column we want to put it back into
@@ -421,7 +411,7 @@ def _insert_on_column(self, result: "DataFrame", obj: "DataFrame"):
421411 # insert at the end
422412 result [name ] = extra_col
423413
424- def _center_window (self , result , window ) -> np .ndarray :
414+ def _center_window (self , result : np . ndarray , window ) -> np .ndarray :
425415 """
426416 Center the result in the window.
427417 """
@@ -480,7 +470,6 @@ def _apply_series(self, homogeneous_func: Callable[..., ArrayLike]) -> "Series":
480470 Series version of _apply_blockwise
481471 """
482472 _ , obj = self ._create_blocks (self ._selected_obj )
483- values = obj .values
484473
485474 try :
486475 values = self ._prep_values (obj .values )
@@ -502,7 +491,7 @@ def _apply_blockwise(
502491
503492 # This isn't quite blockwise, since `blocks` is actually a collection
504493 # of homogenenous DataFrames.
505- blocks , obj = self ._create_blocks (self ._selected_obj )
494+ _ , obj = self ._create_blocks (self ._selected_obj )
506495 mgr = obj ._mgr
507496
508497 def hfunc (bvalues : ArrayLike ) -> ArrayLike :
0 commit comments