Skip to content

BUG: Indexing a timestamp ArrowDtype Index #53652

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 3 commits into from
Jun 20, 2023

Conversation

mroeschke
Copy link
Member

@mroeschke mroeschke commented Jun 13, 2023

@mroeschke mroeschke added Indexing Related to indexing on series/frames, not to indexes themselves Arrow pyarrow functionality labels Jun 13, 2023
@mroeschke mroeschke added this to the 2.0.3 milestone Jun 13, 2023
@@ -6037,7 +6038,7 @@ def _get_indexer_strict(self, key, axis_name: str_t) -> tuple[Index, np.ndarray]
if isinstance(key, Index):
# GH 42790 - Preserve name from an Index
keyarr.name = key.name
if keyarr.dtype.kind in "mM":
if keyarr.dtype.kind in "mM" and not isinstance(keyarr.dtype, ArrowDtype):
Copy link
Member

Choose a reason for hiding this comment

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

i think use lib.is_np_dtype(keyarr.dtype, "mM")?

Copy link
Member Author

Choose a reason for hiding this comment

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

I would have to include DatetimeTZDtype here then too based on failing tests so is lib.is_np_dtype(keyarr.dtype, "mM") or isinstance(keyarr.dtype, DatetimeTZDtype) better?

Copy link
Member

Choose a reason for hiding this comment

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

good point. yes, i think that would be more explicit about the cases that are supposed to go through here


def test_getitem_pyarrow_index(self, frame_or_series):
# GH 53644
pytest.importorskip("pyarrow")
Copy link
Member

Choose a reason for hiding this comment

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

isnt there a decorator for this?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think there is, but I think that decorator can be eventually replaced with this builtin pytest functionality

@jbrockmendel
Copy link
Member

small comment, also needs rebase. otherwise LGTM

@mroeschke mroeschke merged commit f0d3301 into pandas-dev:main Jun 20, 2023
@mroeschke mroeschke deleted the bug/indexing/dt_arrow branch June 20, 2023 22:41
@lumberbot-app
Copy link

lumberbot-app bot commented Jun 20, 2023

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 2.0.x
git pull
  1. Cherry pick the first parent branch of the this PR on top of the older branch:
git cherry-pick -x -m1 f0d3301a4193bb8f567edd7d1e10ad8ae3a16193
  1. You will likely have some merge/cherry-pick conflict here, fix them and commit:
git commit -am 'Backport PR #53652: BUG: Indexing a timestamp ArrowDtype Index'
  1. Push to a named branch:
git push YOURFORK 2.0.x:auto-backport-of-pr-53652-on-2.0.x
  1. Create a PR against branch 2.0.x, I would have named this PR:

"Backport PR #53652 on branch 2.0.x (BUG: Indexing a timestamp ArrowDtype Index)"

And apply the correct labels and milestones.

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

Remember to remove the Still Needs Manual Backport label once the PR gets merged.

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

mroeschke added a commit to mroeschke/pandas that referenced this pull request Jun 20, 2023
mroeschke added a commit that referenced this pull request Jun 21, 2023
* Backport PR #53652: BUG: Indexing a timestamp ArrowDtype Index

* Check for np.dtype only
Daquisu pushed a commit to Daquisu/pandas that referenced this pull request Jul 8, 2023
* BUG: Indexing a timestamp ArrowDtype Index

* more explicit check
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Arrow pyarrow functionality 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: [pyarrow] AttributeError: 'Index' object has no attribute 'freq'
2 participants