File tree Expand file tree Collapse file tree 1 file changed +13
-13
lines changed Expand file tree Collapse file tree 1 file changed +13
-13
lines changed Original file line number Diff line number Diff line change @@ -633,28 +633,28 @@ def agg(self):
633633 obj = self .obj
634634 axis = self .axis
635635
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
641636 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 ()
643649 except TypeError as err :
644650 exc = TypeError (
645651 "DataFrame constructor called with "
646652 f"incompatible data and dtype: { err } "
647653 )
648654 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
655655
656656 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 )
658658
659659 return result
660660
You can’t perform that action at this time.
0 commit comments