@@ -363,20 +363,10 @@ def _cython_agg_general(
363
363
result = self .grouper ._cython_operation (
364
364
"aggregate" , obj ._values , how , axis = 0 , min_count = min_count
365
365
)
366
-
367
- if how == "ohlc" :
368
- # e.g. ohlc
369
- agg_names = ["open" , "high" , "low" , "close" ]
370
- assert len (agg_names ) == result .shape [1 ]
371
- for result_column , result_name in zip (result .T , agg_names ):
372
- key = base .OutputKey (label = result_name , position = idx )
373
- output [key ] = result_column
374
- idx += 1
375
- else :
376
- assert result .ndim == 1
377
- key = base .OutputKey (label = name , position = idx )
378
- output [key ] = result
379
- idx += 1
366
+ assert result .ndim == 1
367
+ key = base .OutputKey (label = name , position = idx )
368
+ output [key ] = result
369
+ idx += 1
380
370
381
371
if not output :
382
372
raise DataError ("No numeric types to aggregate" )
@@ -942,10 +932,6 @@ def count(self) -> Series:
942
932
)
943
933
return self ._reindex_output (result , fill_value = 0 )
944
934
945
- def _apply_to_column_groupbys (self , func ):
946
- """ return a pass thru """
947
- return func (self )
948
-
949
935
def pct_change (self , periods = 1 , fill_method = "pad" , limit = None , freq = None ):
950
936
"""Calculate pct_change of each value to previous entry in group"""
951
937
# TODO: Remove this conditional when #23918 is fixed
@@ -1137,6 +1123,7 @@ def _cython_agg_general(
1137
1123
def _cython_agg_manager (
1138
1124
self , how : str , alt = None , numeric_only : bool = True , min_count : int = - 1
1139
1125
) -> Manager2D :
1126
+ # Note: we never get here with how="ohlc"; that goes through SeriesGroupBy
1140
1127
1141
1128
data : Manager2D = self ._get_data_to_aggregate ()
1142
1129
@@ -1227,21 +1214,13 @@ def array_func(values: ArrayLike) -> ArrayLike:
1227
1214
# generally if we have numeric_only=False
1228
1215
# and non-applicable functions
1229
1216
# try to python agg
1230
-
1231
- if alt is None :
1232
- # we cannot perform the operation
1233
- # in an alternate way, exclude the block
1234
- assert how == "ohlc"
1235
- raise
1236
-
1237
1217
result = py_fallback (values )
1238
1218
1239
1219
return cast_agg_result (result , values , how )
1240
1220
return result
1241
1221
1242
1222
# TypeError -> we may have an exception in trying to aggregate
1243
1223
# continue and exclude the block
1244
- # NotImplementedError -> "ohlc" with wrong dtype
1245
1224
new_mgr = data .grouped_reduce (array_func , ignore_failures = True )
1246
1225
1247
1226
if not len (new_mgr ):
0 commit comments