-
-
Notifications
You must be signed in to change notification settings - Fork 19.3k
Open
Labels
API DesignMissing-datanp.nan, pd.NaT, pd.NA, dropna, isnull, interpolatenp.nan, pd.NaT, pd.NA, dropna, isnull, interpolateNA - MaskedArraysRelated to pd.NA and nullable extension arraysRelated to pd.NA and nullable extension arraysNumeric OperationsArithmetic, Comparison, and Logical operationsArithmetic, Comparison, and Logical operations
Description
In [35]: pd.Series([1, pd.NA], dtype='Int64') ** 0
Out[35]:
0 1
1 1
dtype: Int64
In [36]: pd.Series([1, pd.NA], dtype='Int64[pyarrow]') ** 0
Out[36]:
0 1
1 <NA>
dtype: int64[pyarrow]The pandas nullable types return 1 for NA ** 0, whereas the pyarrow ones preserve NA
Following the general rule outlined in #62506 (comment) by @jorisvandenbossche
I think the general rule is that NA values always propagate in element-wise functions (certainly for a generic ufunc where we might not know what it is doing exactly, for the reason @twast outlined), except for a function that specifically checks for NA (isna/notna).
, and also for compatibility with other tools, I'd suggest that NA should be consistently preserved here
Might this be considered for a breaking change in 3.0? #57064
Metadata
Metadata
Assignees
Labels
API DesignMissing-datanp.nan, pd.NaT, pd.NA, dropna, isnull, interpolatenp.nan, pd.NaT, pd.NA, dropna, isnull, interpolateNA - MaskedArraysRelated to pd.NA and nullable extension arraysRelated to pd.NA and nullable extension arraysNumeric OperationsArithmetic, Comparison, and Logical operationsArithmetic, Comparison, and Logical operations