-
-
Notifications
You must be signed in to change notification settings - Fork 18.3k
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: move logic of 'block manager axis' into the BlockManager #40075
REF: move logic of 'block manager axis' into the BlockManager #40075
Conversation
+1 |
yep +1 on moving this to the BM. |
I also added the change for Other uses cases are eg in |
@@ -385,7 +385,10 @@ def apply( | |||
|
|||
return type(self)(result_arrays, new_axes) | |||
|
|||
def apply_with_block(self: T, f, align_keys=None, **kwargs) -> T: | |||
def apply_with_block(self: T, f, align_keys=None, swap_axis=True, **kwargs) -> T: | |||
# switch axis to follow BlockManager logic |
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.
is this needed now that you have a _normalize_axis?
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.
Yes, it is still needed here because this is the function that does the "use block method as fallback" (and the block method is still using its inverted axis logic).
(but I am actively removing the usage of apply_with_block
, like #40196)
can you merge master |
once more merge master pls |
@jreback @jbrockmendel what are your thoughts about doing this?
Currently the 0/1 -> 1/0 axis switch for the BlockManager happens on the DataFrame side, while I think it would be a bit cleaner to let this be the responsibility of the BlockManager method being called.
For illustration, the diff of this PR is such a change for the
diff()
method: instead of using_get_block_manager_axis
in frame.py, it's theBlockManager.diff()
method that takes care of this (so just moving it down a level).