Hi Carlos, Yes, good idea to add "where" wherever it makes sense -- indeed, that would be good even if we do not deprecate the nan-ignoring functions.
As you noted, a version where one does isnan(data) actually costs less memory than the nan* functions, since those do ``isnan(data)`` too and, if any nan are present, the whole data array is copied, with nan replaced with appropriate fill values. Currently, the only way without chaning numpy code to avoid large arrays altogether is by having either a nan-aware data type (which can do the filling on the smaller chunks given by the iterator by having a promotor, or have custom loops for various functions). I wonder if we could short-circuit that to some extent, e.g., suppose we do have ``where`` generally, one could imagine having a special marker, e.g., used like ``where=np.NOT_NAN``, which would get special treatment used inside the reduction loops, in the same way the current code treats special-cases having a where array. (One could even go further and allow passing in any ufunc to where, as long as it has an approriate data_type->bool loop. But that's probably overdesigning it.) All the best, Marten "Carlos Martin" <[email protected]> writes: > Another, perhaps more radical, possibility is to remove special handling for > nans from NumPy entirely. More precisely: > > 1. Add a `where` argument to all normal counterparts of nan-ignoring > functions that are currently missing it (see > https://github.com/numpy/numpy/issues/26336). > 2. Add a short FAQ entry to the docs instructing users to use > `where=~np.isnan(a)` to ignore nans. (Optional.) > 3. Add a deprecation warning to the nan-ignoring functions. > 4. Delete the nan-ignoring functions after an appropriate deprecation cycle. > _______________________________________________ > NumPy-Discussion mailing list -- [email protected] > To unsubscribe send an email to [email protected] > https://mail.python.org/mailman3//lists/numpy-discussion.python.org > Member address: [email protected] _______________________________________________ NumPy-Discussion mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3//lists/numpy-discussion.python.org Member address: [email protected]
