-
- Notifications
You must be signed in to change notification settings - Fork 19.4k
Open
Labels
BugError ReportingIncorrect or improved errors from pandasIncorrect or improved errors from pandasIndexingRelated to indexing on series/frames, not to indexes themselvesRelated to indexing on series/frames, not to indexes themselvesNA - MaskedArraysRelated to pd.NA and nullable extension arraysRelated to pd.NA and nullable extension arrays
Description
Currently, indexing with a list including pd.NA (so the list version of indexing with a BooleanArray or IntegerArray) works on the array, but not on Series:
("works" = raising the correct error message)
In [21]: a = pd.array([1, 2, 3]) In [22]: a[[True, False, pd.NA]] ... ValueError: Cannot mask with a boolean indexer containing NA values In [23]: a[[0, 1, pd.NA]] ... ValueError: Cannot index with an integer indexer containing NA values vs
In [24]: s = pd.Series(a) In [25]: s[[True, False, pd.NA]] ... KeyError: 'Passing list-likes to .loc or [] with any missing labels is no longer supported, see https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#deprecate-loc-reindex-listlike' In [26]: s[[0, 1, pd.NA]] ... TypeError: boolean value of NA is ambiguous Because the validation of the indexer isn't yet updated to handle listlikes that include pd.NA.
And similar problems for setitem.
Metadata
Metadata
Assignees
Labels
BugError ReportingIncorrect or improved errors from pandasIncorrect or improved errors from pandasIndexingRelated to indexing on series/frames, not to indexes themselvesRelated to indexing on series/frames, not to indexes themselvesNA - MaskedArraysRelated to pd.NA and nullable extension arraysRelated to pd.NA and nullable extension arrays