Skip to content

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

Merged

Conversation

jorisvandenbossche
Copy link
Member

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

@jorisvandenbossche jorisvandenbossche added Refactor Internal refactoring of code Internals Related to non-user accessible pandas implementation Apply Apply, Aggregate, Transform, Map labels Mar 2, 2021
@@ -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)
Copy link
Member

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

@@ -1646,6 +1646,15 @@ def fast_xs(self, loc):
"""
raise NotImplementedError("Use series._values[loc] instead")

def set_values(self, values):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

values: ArrayLike

@jbrockmendel
Copy link
Member

small comments, otherwise LGTM

Copy link
Contributor

@jreback jreback left a 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

@jorisvandenbossche jorisvandenbossche merged commit 7648a8d into pandas-dev:master Mar 2, 2021
@jorisvandenbossche jorisvandenbossche deleted the am-ref-apply_frame branch March 2, 2021 17:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Apply Apply, Aggregate, Transform, Map Internals Related to non-user accessible pandas implementation Refactor Internal refactoring of code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants