@@ -349,24 +349,27 @@ def _verify_integrity(self) -> None:
349
349
f"tot_items: { tot_items } "
350
350
)
351
351
352
- def reduce (self , func , * args , ** kwargs ):
352
+ def reduce (self , func , name , skipna = True , ** kwds ):
353
353
# If 2D, we assume that we're operating column-wise
354
354
if self .ndim == 1 :
355
355
# we'll be returning a scalar
356
356
blk = self .blocks [0 ]
357
- return func (blk .values , * args , ** kwargs )
357
+ return func (blk .values )
358
358
359
359
res = {}
360
360
for blk in self .blocks :
361
- bres = func (blk .values , * args , ** kwargs )
361
+ if isinstance (blk , ExtensionBlock ):
362
+ bres = blk .values ._reduce (name , skipna = skipna , ** kwds )
363
+ else :
364
+ bres = func (blk .values )
362
365
363
366
if np .ndim (bres ) == 0 :
364
367
# EA
365
368
assert blk .shape [0 ] == 1
366
369
new_res = zip (blk .mgr_locs .as_array , [bres ])
367
370
else :
368
371
assert bres .ndim == 1 , bres .shape
369
- assert blk .shape [0 ] == len (bres ), (blk .shape , bres .shape , args , kwargs )
372
+ assert blk .shape [0 ] == len (bres ), (blk .shape , bres .shape )
370
373
new_res = zip (blk .mgr_locs .as_array , bres )
371
374
372
375
nr = dict (new_res )
0 commit comments