@@ -355,15 +355,15 @@ def _aggregate_multiple_funcs(self, arg):
355
355
# TODO: index should not be Optional - see GH 35490
356
356
def _wrap_series_output (
357
357
self ,
358
- output : Mapping [base .OutputKey , Union [Series , np . ndarray ]],
358
+ output : Mapping [base .OutputKey , Union [Series , ArrayLike ]],
359
359
index : Optional [Index ],
360
360
) -> FrameOrSeriesUnion :
361
361
"""
362
362
Wraps the output of a SeriesGroupBy operation into the expected result.
363
363
364
364
Parameters
365
365
----------
366
- output : Mapping[base.OutputKey, Union[Series, np.ndarray]]
366
+ output : Mapping[base.OutputKey, Union[Series, np.ndarray, ExtensionArray ]]
367
367
Data to wrap.
368
368
index : pd.Index or None
369
369
Index to apply to the output.
@@ -420,14 +420,14 @@ def _wrap_aggregated_output(
420
420
return self ._reindex_output (result )
421
421
422
422
def _wrap_transformed_output (
423
- self , output : Mapping [base .OutputKey , Union [Series , np . ndarray ]]
423
+ self , output : Mapping [base .OutputKey , Union [Series , ArrayLike ]]
424
424
) -> Series :
425
425
"""
426
426
Wraps the output of a SeriesGroupBy aggregation into the expected result.
427
427
428
428
Parameters
429
429
----------
430
- output : dict[base.OutputKey, Union[Series, np.ndarray]]
430
+ output : dict[base.OutputKey, Union[Series, np.ndarray, ExtensionArray ]]
431
431
Dict with a sole key of 0 and a value of the result values.
432
432
433
433
Returns
@@ -1119,6 +1119,7 @@ def cast_agg_result(result, values: ArrayLike, how: str) -> ArrayLike:
1119
1119
1120
1120
if isinstance (values , Categorical ) and isinstance (result , np .ndarray ):
1121
1121
# If the Categorical op didn't raise, it is dtype-preserving
1122
+ # We get here with how="first", "last", "min", "max"
1122
1123
result = type (values )._from_sequence (result .ravel (), dtype = values .dtype )
1123
1124
# Note this will have result.dtype == dtype from above
1124
1125
@@ -1195,9 +1196,7 @@ def array_func(values: ArrayLike) -> ArrayLike:
1195
1196
assert how == "ohlc"
1196
1197
raise
1197
1198
1198
- # error: Incompatible types in assignment (expression has type
1199
- # "ExtensionArray", variable has type "ndarray")
1200
- result = py_fallback (values ) # type: ignore[assignment]
1199
+ result = py_fallback (values )
1201
1200
1202
1201
return cast_agg_result (result , values , how )
1203
1202
@@ -1753,14 +1752,14 @@ def _wrap_aggregated_output(
1753
1752
return self ._reindex_output (result )
1754
1753
1755
1754
def _wrap_transformed_output (
1756
- self , output : Mapping [base .OutputKey , Union [Series , np . ndarray ]]
1755
+ self , output : Mapping [base .OutputKey , Union [Series , ArrayLike ]]
1757
1756
) -> DataFrame :
1758
1757
"""
1759
1758
Wraps the output of DataFrameGroupBy transformations into the expected result.
1760
1759
1761
1760
Parameters
1762
1761
----------
1763
- output : Mapping[base.OutputKey, Union[Series, np.ndarray]]
1762
+ output : Mapping[base.OutputKey, Union[Series, np.ndarray, ExtensionArray ]]
1764
1763
Data to wrap.
1765
1764
1766
1765
Returns
0 commit comments