ser = pd.Series(['a', np.nan, 'c'], dtype=object)
>>> ser + "b"
0 ab
1 NaN
2 cb
dtype: object
The operation here goes through ops.array_ops where it raises, then falls back to _masked_arith_op
where it only operates on non-na entries. This seems mostly motivated by supporting strings-with-nans, but was implemented before StringArray implemented this support (better). Do we still need this fallback behavior?
Comment From: jbrockmendel
xref #41764
Comment From: rhshadrach
I think the proposal here is "NaN + numeric" is still NaN, but "NaN + non-numeric" raises - is that right? +1 if so.
For this, I wonder if we should be treating Boolean values as numeric:
print(np.nan + True)
# nan
print(np.nan + np.array([True])[0])
# nan
Comment From: jbrockmendel
I think the proposal here is "NaN + numeric" is still NaN, but "NaN + non-numeric" raises - is that right? +1 if so.
That's a good way to put it, yes.
Comment From: jbrockmendel
Effectively the same thing for logical ops in na_logical op causes confusion e.g. #40565