Add a method to ExtensionArray interface for whether an array contains NAs #22680
Labels
Enhancement
ExtensionArray
Extending pandas with custom dtypes or arrays.
Performance
Memory or execution speed performance
Milestone
In lots of places, pandas does something like
if np.any(arr.isna())
, which is wasteful as we have to create an ndarray of booleans just to check whether there are anyTrue
values.Some arrays, like Arrow, know ahead of time whether there are any NAs in the array. Would it make sense to expose an API for an array saying whether they have any missing values?
With indexes, we work around this by caching a
_hasnans
value. That wouldn't work for mutable arrays.The text was updated successfully, but these errors were encountered: