@@ -252,33 +252,20 @@ def apply_broadcast(self, target: "DataFrame") -> "DataFrame":
252
252
return result
253
253
254
254
def apply_standard (self ):
255
-
256
- # partial result that may be returned from reduction
257
- partial_result = None
258
-
259
- # compute the result using the series generator,
260
- # use the result computed while trying to reduce if available.
261
- results , res_index = self .apply_series_generator (partial_result )
255
+ results , res_index = self .apply_series_generator ()
262
256
263
257
# wrap results
264
258
return self .wrap_results (results , res_index )
265
259
266
- def apply_series_generator (self , partial_result = None ) -> Tuple [ResType , "Index" ]:
260
+ def apply_series_generator (self ) -> Tuple [ResType , "Index" ]:
267
261
series_gen = self .series_generator
268
262
res_index = self .result_index
269
263
270
264
results = {}
271
265
272
- # If a partial result was already computed,
273
- # use it instead of running on the first element again
274
- series_gen_enumeration = enumerate (series_gen )
275
- if partial_result is not None :
276
- i , v = next (series_gen_enumeration )
277
- results [i ] = partial_result
278
-
279
266
if self .ignore_failures :
280
267
successes = []
281
- for i , v in series_gen_enumeration :
268
+ for i , v in enumerate ( series_gen ) :
282
269
try :
283
270
results [i ] = self .f (v )
284
271
except Exception :
@@ -292,7 +279,7 @@ def apply_series_generator(self, partial_result=None) -> Tuple[ResType, "Index"]
292
279
293
280
else :
294
281
with option_context ("mode.chained_assignment" , None ):
295
- for i , v in series_gen_enumeration :
282
+ for i , v in enumerate ( series_gen ) :
296
283
# ignore SettingWithCopy here in case the user mutates
297
284
results [i ] = self .f (v )
298
285
if isinstance (results [i ], ABCSeries ):
0 commit comments