Skip to content

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
# 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

"""
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

3 participants