File tree 1 file changed +13
-13
lines changed
1 file changed +13
-13
lines changed Original file line number Diff line number Diff line change @@ -633,28 +633,28 @@ def agg(self):
633
633
obj = self .obj
634
634
axis = self .axis
635
635
636
- # TODO: Avoid having to change state
637
- self .obj = self .obj if self .axis == 0 else self .obj .T
638
- self .axis = 0
639
-
640
- result = None
641
636
try :
642
- result = super ().agg ()
637
+ if axis == 1 :
638
+ result = FrameRowApply (
639
+ obj .T ,
640
+ self .orig_f ,
641
+ self .raw ,
642
+ self .result_type ,
643
+ self .args ,
644
+ self .kwargs ,
645
+ ).agg ()
646
+ result = result .T if result is not None else result
647
+ else :
648
+ result = super ().agg ()
643
649
except TypeError as err :
644
650
exc = TypeError (
645
651
"DataFrame constructor called with "
646
652
f"incompatible data and dtype: { err } "
647
653
)
648
654
raise exc from err
649
- finally :
650
- self .obj = obj
651
- self .axis = axis
652
-
653
- if axis == 1 :
654
- result = result .T if result is not None else result
655
655
656
656
if result is None :
657
- result = self . obj .apply (self .orig_f , axis , args = self .args , ** self .kwargs )
657
+ result = obj .apply (self .orig_f , axis , args = self .args , ** self .kwargs )
658
658
659
659
return result
660
660
You can’t perform that action at this time.
0 commit comments