NumPy has the following nan-ignoring functions:

Mathematical functions:

- https://numpy.org/doc/stable/reference/generated/numpy.nanprod.html
- https://numpy.org/doc/stable/reference/generated/numpy.nansum.html
- https://numpy.org/doc/stable/reference/generated/numpy.nancumprod.html
- https://numpy.org/doc/stable/reference/generated/numpy.nancumsum.html
- https://numpy.org/doc/stable/reference/generated/numpy.nanmax.html
- https://numpy.org/doc/stable/reference/generated/numpy.nanmin.html

Sorting, searching, and counting:

- https://numpy.org/doc/stable/reference/generated/numpy.nanargmax.html
- https://numpy.org/doc/stable/reference/generated/numpy.nanargmin.html

Statistics:

- https://numpy.org/doc/stable/reference/generated/numpy.nanpercentile.html
- https://numpy.org/doc/stable/reference/generated/numpy.nanquantile.html
- https://numpy.org/doc/stable/reference/generated/numpy.nanmedian.html
- https://numpy.org/doc/stable/reference/generated/numpy.nanmean.html
- https://numpy.org/doc/stablereference/generated/numpy.nanstd.html
- https://numpy.org/doc/stable/reference/generated/numpy.nanvar.html

Suggestion: Replace these functions with an ignore_nan flag to their normal 
counterparts. This avoids having entirely separate functions just to filter out 
nans, and shrinks the size of the codebase. It is also more user-friendly: it 
is simpler and easier to toggle a boolean flag.

This has been briefly suggested before:

- 
https://mail.python.org/archives/list/[email protected]/message/FQ362NGJLOJFN3BCJVST5TAQZCVWZTNO/
- https://github.com/numpy/numpy/pull/25474#issuecomment-1868484678
_______________________________________________
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]

Reply via email to