Skip to content

Fixed Series.apply performance regression #35166

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 8, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fixed Series.apply performance regression
Set the option once, rather than in the loop.

Closes #35047
  • Loading branch information
TomAugspurger committed Jul 7, 2020
commit fcc44d57366eb75b3607c74a0aaeaa9abedfdd94
5 changes: 2 additions & 3 deletions pandas/core/apply.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,9 +291,8 @@ def apply_series_generator(self, partial_result=None) -> Tuple[ResType, "Index"]
res_index = res_index.take(successes)

else:
for i, v in series_gen_enumeration:

with option_context("mode.chained_assignment", None):
with option_context("mode.chained_assignment", None):
for i, v in series_gen_enumeration:
# ignore SettingWithCopy here in case the user mutates
results[i] = self.f(v)

Expand Down