Skip to content

BUG: 1D slices over extension types turn into N-dimensional slices over ExtensionArrays #42787

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
merged 8 commits into from
Jul 31, 2021

Conversation

frreiss
Copy link
Contributor

@frreiss frreiss commented Jul 28, 2021

This PR contains a 1-line patch for issue #42430, plus a regression test to ensure the issue does not recur.

Before this change, ExtensionBlock. getitem_block_index() would request 2D slices of a block's underlying extension array, even though the __getitem__() method of ExtensionArray is (currently) only supposed to support 1D slicing. After the change, getitem_block_index() requests 1D slices. The change also fixes some linter/type checking errors.

@jreback jreback changed the title Fix for Issue 42430 BUG: 1D slices over extension types turn into N-dimensional slices over ExtensionArrays Jul 28, 2021
@frreiss
Copy link
Contributor Author

frreiss commented Jul 30, 2021

Looks like there was a single test failure on one of the CI builds. I'm not able to reproduce that failure on my machine. Can someone with the appropriate permissions rerun the pytest (actions-39-numpydev.yaml, not slow and not network, xsel, deprecate, -W error) build to see if the problem goes away by itself?

@jbrockmendel
Copy link
Member

that should be fixed if you merge master

@jreback jreback added Bug ExtensionArray Extending pandas with custom dtypes or arrays. Indexing Related to indexing on series/frames, not to indexes themselves labels Jul 31, 2021
@jreback jreback added this to the 1.3.2 milestone Jul 31, 2021
@jreback jreback merged commit 26e7c0f into pandas-dev:master Jul 31, 2021
@lumberbot-app
Copy link

lumberbot-app bot commented Jul 31, 2021

Owee, I'm MrMeeseeks, Look at me.

There seem to be a conflict, please backport manually. Here are approximate instructions:

  1. Checkout backport branch and update it.
$ git checkout 1.3.x
$ git pull
  1. Cherry pick the first parent branch of the this PR on top of the older branch:
$ git cherry-pick -m1 26e7c0f840197259f3af06a397df99b9b9f638a3
  1. You will likely have some merge/cherry-pick conflict here, fix them and commit:
$ git commit -am 'Backport PR #42787: BUG: 1D slices over extension types turn into N-dimensional slices over ExtensionArrays'
  1. Push to a named branch :
git push YOURFORK 1.3.x:auto-backport-of-pr-42787-on-1.3.x
  1. Create a PR against branch 1.3.x, I would have named this PR:

"Backport PR #42787 on branch 1.3.x"

And apply the correct labels and milestones.

Congratulation you did some good work ! Hopefully your backport PR will be tested by the continuous integration and merged soon!

If these instruction are inaccurate, feel free to suggest an improvement.

@jreback
Copy link
Contributor

jreback commented Jul 31, 2021

thanks @frreiss for the patch!

@jreback
Copy link
Contributor

jreback commented Jul 31, 2021

@meeseeksdev backport 1.3.x

@lumberbot-app
Copy link

lumberbot-app bot commented Jul 31, 2021

Owee, I'm MrMeeseeks, Look at me.

There seem to be a conflict, please backport manually. Here are approximate instructions:

  1. Checkout backport branch and update it.
$ git checkout 1.3.x
$ git pull
  1. Cherry pick the first parent branch of the this PR on top of the older branch:
$ git cherry-pick -m1 26e7c0f840197259f3af06a397df99b9b9f638a3
  1. You will likely have some merge/cherry-pick conflict here, fix them and commit:
$ git commit -am 'Backport PR #42787: BUG: 1D slices over extension types turn into N-dimensional slices over ExtensionArrays'
  1. Push to a named branch :
git push YOURFORK 1.3.x:auto-backport-of-pr-42787-on-1.3.x
  1. Create a PR against branch 1.3.x, I would have named this PR:

"Backport PR #42787 on branch 1.3.x"

And apply the correct labels and milestones.

Congratulation you did some good work ! Hopefully your backport PR will be tested by the continuous integration and merged soon!

If these instruction are inaccurate, feel free to suggest an improvement.

@jreback
Copy link
Contributor

jreback commented Jul 31, 2021

@frreiss if you wouldn't mind following the instructions above to manually backport this (above).

dicristina added a commit to dicristina/pandas that referenced this pull request Jul 31, 2021
simonjayhawkins pushed a commit to simonjayhawkins/pandas that referenced this pull request Aug 2, 2021
…n into N-dimensional slices over ExtensionArrays
@simonjayhawkins
Copy link
Member

conflicts due to #42422. manual backport done in #42850

simonjayhawkins added a commit that referenced this pull request Aug 2, 2021
…imensional slices over ExtensionArrays (#42850)

Co-authored-by: Fred Reiss <[email protected]>
feefladder pushed a commit to feefladder/pandas that referenced this pull request Sep 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug ExtensionArray Extending pandas with custom dtypes or arrays. Indexing Related to indexing on series/frames, not to indexes themselves
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: 1D slices over extension types turn into N-dimensional slices over ExtensionArrays
4 participants