Skip to content
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

BUG (string dtype): looking up missing value in the Index fails #59879

Open
jorisvandenbossche opened this issue Sep 23, 2024 · 0 comments
Open
Labels
Bug Index Related to the Index class or subclasses Strings String extension data type and string data
Milestone

Comments

@jorisvandenbossche
Copy link
Member

jorisvandenbossche commented Sep 23, 2024

#59765 is the general issue about consistency in index lookups for missing values, but shorter term, we at least need to fix being able to lookup missing values for the future string dtype.

With object dtype, this works fine:

>>> idx = pd.Index(["a", "b", None])
>>> idx.get_loc(None)
2

But when enabling the string dtype, neither None or np.nan work as key:

>>> pd.options.future.infer_string = True
>>> idx = pd.Index(["a", "b", None])
>>> idx.get_loc(None)
...
KeyError: None
>>> idx.get_loc(np.nan)
...
KeyError: nan
@jorisvandenbossche jorisvandenbossche added Bug Strings String extension data type and string data Index Related to the Index class or subclasses labels Sep 23, 2024
@jorisvandenbossche jorisvandenbossche added this to the 2.3 milestone Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Index Related to the Index class or subclasses Strings String extension data type and string data
Projects
None yet
Development

No branches or pull requests

1 participant