-
-
Notifications
You must be signed in to change notification settings - Fork 18.7k
Closed
Labels
API - ConsistencyInternal Consistency of API/BehaviorInternal Consistency of API/BehaviorDuplicate ReportDuplicate issue or pull requestDuplicate issue or pull requestExtensionArrayExtending pandas with custom dtypes or arrays.Extending pandas with custom dtypes or arrays.Missing-datanp.nan, pd.NaT, pd.NA, dropna, isnull, interpolatenp.nan, pd.NaT, pd.NA, dropna, isnull, interpolateisinisin methodisin method
Description
The current behavior singles out pd.NA
:
In [3]: ser = pd.Series([pd.NA], dtype="Int64")
In [4]: ser.isin([pd.NA])
Out[4]:
0 True
dtype: boolean
In [5]: ser.isin([np.nan])
Out[5]:
0 False
dtype: boolean
StringArray.isin
also follows this behavior, so it is not MaskedArray
specific.
There was discussion about this being problematic since _from_sequence
will treat other missing values just the same as pd.NA
(#42473 (comment)). In that case, the output in the second case should also be True
.
As a final option, both outputs could be pd.NA
. In #38379 there was discussion of propagating pd.NA
instead of True/False
depending on the presence of missing values in the values
argument. A nice description of that debate is here #38379 (comment).
Metadata
Metadata
Assignees
Labels
API - ConsistencyInternal Consistency of API/BehaviorInternal Consistency of API/BehaviorDuplicate ReportDuplicate issue or pull requestDuplicate issue or pull requestExtensionArrayExtending pandas with custom dtypes or arrays.Extending pandas with custom dtypes or arrays.Missing-datanp.nan, pd.NaT, pd.NA, dropna, isnull, interpolatenp.nan, pd.NaT, pd.NA, dropna, isnull, interpolateisinisin methodisin method