API: Should isna return a copy for nullable types? (original) (raw)
This came up in #40651, seems worth resolving. Right now BaseMaskedArray just directly returns self._mask in the implementation of isna. This could lead to some unintuitive user-facing behavior like:
>>> ser = pd.Series([1, 1, 1], dtype="Int64")
>>> mask = ser.isna()
>>> mask[:] = True
>>> ser
0 <NA>
1 <NA>
2 <NA>
dtype: Int64
Seems like isna should return a copy instead to avoid this. One potential downside is losing an API-supported way to obtain 0-cost access to the mask (xref #34873).