Skip to content

Commit 8f54d14

Browse files
authored
Remove leftover partial-result code (pandas-dev#35397)
1 parent 00ea10c commit 8f54d14

File tree

1 file changed

+4
-17
lines changed

1 file changed

+4
-17
lines changed

pandas/core/apply.py

+4-17
Original file line numberDiff line numberDiff line change
@@ -252,33 +252,20 @@ def apply_broadcast(self, target: "DataFrame") -> "DataFrame":
252252
return result
253253

254254
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()
262256

263257
# wrap results
264258
return self.wrap_results(results, res_index)
265259

266-
def apply_series_generator(self, partial_result=None) -> Tuple[ResType, "Index"]:
260+
def apply_series_generator(self) -> Tuple[ResType, "Index"]:
267261
series_gen = self.series_generator
268262
res_index = self.result_index
269263

270264
results = {}
271265

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-
279266
if self.ignore_failures:
280267
successes = []
281-
for i, v in series_gen_enumeration:
268+
for i, v in enumerate(series_gen):
282269
try:
283270
results[i] = self.f(v)
284271
except Exception:
@@ -292,7 +279,7 @@ def apply_series_generator(self, partial_result=None) -> Tuple[ResType, "Index"]
292279

293280
else:
294281
with option_context("mode.chained_assignment", None):
295-
for i, v in series_gen_enumeration:
282+
for i, v in enumerate(series_gen):
296283
# ignore SettingWithCopy here in case the user mutates
297284
results[i] = self.f(v)
298285
if isinstance(results[i], ABCSeries):

0 commit comments

Comments
 (0)