> Assuming totally normal numpy arrays, the former will first produce a boolean 
> array of size N, then a second boolean array of size N to have the negated 
> values. Meanwhile, no such extra arrays are made for the latter case. So, you 
> are asking users to move to a potentially less performant alternative that 
> will use more memory.

I believe nanmean also creates a mask: 
https://github.com/numpy/numpy/blob/0532af47d6a815298b7841de00bdbc547104b237/numpy/lib/_nanfunctions_impl.py#L1032C17-L1032C35.

Here's the _replace_nan function that's used to do this: 
https://github.com/numpy/numpy/blob/0532af47d6a815298b7841de00bdbc547104b237/numpy/lib/_nanfunctions_impl.py#L70.
_______________________________________________
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