-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
REF: remove internal Block usage from FrameColumnApply #40166
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
REF: remove internal Block usage from FrameColumnApply #40166
Conversation
pandas/core/apply.py
Outdated
@@ -896,7 +895,7 @@ def series_generator(self): | |||
for (arr, name) in zip(values, self.index): | |||
# GH#35462 re-pin mgr in case setitem changed it | |||
ser._mgr = mgr | |||
blk.values = arr | |||
ser._mgr.set_values(arr) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
small perf gain by using mgr
instead of ser._mgr
pandas/core/internals/managers.py
Outdated
@@ -1646,6 +1646,15 @@ def fast_xs(self, loc): | |||
""" | |||
raise NotImplementedError("Use series._values[loc] instead") | |||
|
|||
def set_values(self, values): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
values: ArrayLike
small comments, otherwise LGTM |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm ex @jbrockmendel comments
In the
apply
code, there is still one case where we are directly using the internal blocks. This moves that to a method on the manager, so we don't have to interact directly with the blocks (which ideally we don't want outside of the internals, and let's ArrayManager cleanly support this as well).For the rest it still updates the Series' values in place, preserving the performance trick.
cc @jbrockmendel @rhshadrach