On Thu, Nov 18, 2021 at 1:46 PM Jouke Witteveen <j.witteveen@gmail.com> wrote:
On Wed, Nov 17, 2021 at 7:51 PM Andras Deak <deak.andris@gmail.com> wrote:
On Wed, Nov 17, 2021 at 7:39 PM Sebastian Berg <sebastian@sipsolutions.net> wrote:
Hi all,
the `np.ndenumerate` does not work well for masked arrays (like many main namespace functions, it simply ignores/drops the mask).
There is a PR (https://github.com/numpy/numpy/pull/20020) to add a version of it to `np.ma` (masked array specific). And we thought it seemed reasonable and were planning on putting it in.
This version skips all masked elements. An alternative could be to return `np.ma.masked` for masked elements?
Would it be a bad idea to add a kwarg that specifies this behaviour (i.e. offering both alternatives)? Assuming people might need the masked items to be there under certain circumstances. Perhaps when zipping masked data with dense data?
I appended a commit to the PR that implements the kwarg for optionally yielding masked elements. Regards, - Jouke