@@ -43,7 +43,7 @@ def frame_apply(
43
43
result_type : Optional [str ] = None ,
44
44
args = None ,
45
45
kwds = None ,
46
- ):
46
+ ) -> FrameApply :
47
47
""" construct and return a row or column based frame apply object """
48
48
axis = obj ._get_axis_number (axis )
49
49
klass : Type [FrameApply ]
@@ -63,35 +63,9 @@ def frame_apply(
63
63
)
64
64
65
65
66
- class FrameApply (metaclass = abc .ABCMeta ):
67
-
68
- # ---------------------------------------------------------------
69
- # Abstract Methods
66
+ class Apply (metaclass = abc .ABCMeta ):
70
67
axis : int
71
68
72
- @property
73
- @abc .abstractmethod
74
- def result_index (self ) -> Index :
75
- pass
76
-
77
- @property
78
- @abc .abstractmethod
79
- def result_columns (self ) -> Index :
80
- pass
81
-
82
- @property
83
- @abc .abstractmethod
84
- def series_generator (self ) -> Iterator [Series ]:
85
- pass
86
-
87
- @abc .abstractmethod
88
- def wrap_results_for_axis (
89
- self , results : ResType , res_index : Index
90
- ) -> FrameOrSeriesUnion :
91
- pass
92
-
93
- # ---------------------------------------------------------------
94
-
95
69
def __init__ (
96
70
self ,
97
71
obj : DataFrame ,
@@ -132,6 +106,42 @@ def f(x):
132
106
133
107
self .f : AggFuncType = f
134
108
109
+ @property
110
+ def index (self ) -> Index :
111
+ return self .obj .index
112
+
113
+ @abc .abstractmethod
114
+ def get_result (self ):
115
+ pass
116
+
117
+
118
+ class FrameApply (Apply ):
119
+ # ---------------------------------------------------------------
120
+ # Abstract Methods
121
+
122
+ @property
123
+ @abc .abstractmethod
124
+ def result_index (self ) -> Index :
125
+ pass
126
+
127
+ @property
128
+ @abc .abstractmethod
129
+ def result_columns (self ) -> Index :
130
+ pass
131
+
132
+ @property
133
+ @abc .abstractmethod
134
+ def series_generator (self ) -> Iterator [Series ]:
135
+ pass
136
+
137
+ @abc .abstractmethod
138
+ def wrap_results_for_axis (
139
+ self , results : ResType , res_index : Index
140
+ ) -> FrameOrSeriesUnion :
141
+ pass
142
+
143
+ # ---------------------------------------------------------------
144
+
135
145
@property
136
146
def res_columns (self ) -> Index :
137
147
return self .result_columns
@@ -140,10 +150,6 @@ def res_columns(self) -> Index:
140
150
def columns (self ) -> Index :
141
151
return self .obj .columns
142
152
143
- @property
144
- def index (self ) -> Index :
145
- return self .obj .index
146
-
147
153
@cache_readonly
148
154
def values (self ):
149
155
return self .obj .values
0 commit comments