-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
PERF: Split blocks in blk.delete #50148
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
Conversation
cc @jbrockmendel would you mind having a look here? |
will look over the weekend (applies to many many pings in my inbox) |
@@ -1531,11 +1531,11 @@ def putmask(self, mask, new) -> list[Block]: | |||
|
|||
return [self] | |||
|
|||
def delete(self, loc) -> Block: | |||
def delete(self, loc) -> list[Block]: |
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.
for 2D EAs we probably want to do the same thing as we do for NumpyBlock?
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.
Do we have any 2D EAs? I agree in general, but thought all of them were 1D
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.
see NDArrayBackedExtensionBlock
pandas/core/internals/blocks.py
Outdated
new_blocks: list[Block] = [] | ||
|
||
previous_loc = -1 | ||
for idx in loc: |
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.
this reminds me of BlockManager._slice_take_blocks_ax0
with only_slice=True
if we passed e.g. slice_or_indexer = np.delete(np.arange(length), loc))
. is it worth trying to de-duplicate?
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.
Not sure, this seemed to do something different than what we need. Tried to get it to work a while back, but didn't get it to work
looks like some mypy complaints |
Thx, fixed mypy |
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 cc @mroeschke
Thanks @phofl |
doc/source/whatsnew/vX.X.X.rst
file if fixing a bug or adding a new feature.