Skip to content

BUG: bug in Index._should_fallback_to_positional #51241

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

Conversation

topper-123
Copy link
Contributor

Fixes #51053.

if isinstance(self.dtype, np.dtype) and self.dtype.kind in ["i", "u", "f"]:
return False
return not self._holds_integer()
return not is_numeric_dtype(self.dtype) or is_bool_dtype(self.dtype)
Copy link
Member

Choose a reason for hiding this comment

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

does this impact perf? the is_foo_dtype checks are pretty slow

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It probably does a bit. For float64 I get 1.71 µs, would probably be faster to use infer_dtype (after #51054).

I cabn do a timing after #51054 has been merged.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I looked into using inferred and it is better, 120 ns now, vs 1000 ns in first version.

@mroeschke mroeschke added Indexing Related to indexing on series/frames, not to indexes themselves NA - MaskedArrays Related to pd.NA and nullable extension arrays labels Feb 8, 2023
@mroeschke mroeschke added this to the 2.0 milestone Feb 13, 2023
@mroeschke mroeschke merged commit c7fa611 into pandas-dev:main Feb 13, 2023
@mroeschke
Copy link
Member

Thanks @topper-123

@topper-123 topper-123 deleted the bug_Index._should_fallback_to_positional branch February 13, 2023 23:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Indexing Related to indexing on series/frames, not to indexes themselves NA - MaskedArrays Related to pd.NA and nullable extension arrays
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: Indexing with pd.Float(32|64)Dtype indexes is different than with numpy float indexes
3 participants