-
-
Notifications
You must be signed in to change notification settings - Fork 12k
Description
Proposed new feature or change:
My motivation comes from this PR in sklearn https://github.com/scikit-learn/scikit-learn/pull/23183/files#diff-b62de604fe871c9d2dcbfc799daf93b5bcebef1bf08341a0a7fc7562ba20b337R148, where I wrote:
Wrapper for np.average, with np.nan values being ignored from the average
This is similar to np.nanmean, but allowing to pass weights as in np.average
The ideas would be to add this functionality to one of the two functions, i.e:
a) add weights to np.nanmean: https://numpy.org/doc/stable/reference/generated/numpy.nanmean.html
b) add option to ignore nan's for np.average : https://numpy.org/doc/stable/reference/generated/numpy.average.html
I'm aware of https://numpy.org/doc/stable/reference/generated/numpy.ma.average.html#numpy.ma.average but to be honest, I think it'd still be useful to implicitly indicate the mask with np.nan in the value, rather than having to create a masked array.
I'm happy to (at least try) do the PR myself, but would like some feedback on the idea / scope / api, and whether I missed some already existing method.