[Numpy-discussion] Adding an nd generalization of np.ma.mask_rowscols

2020-01-17 Thread Eric Wieser
Today, numpy has a np.ma.mask_rowcols function, which stretches masks along the full length of an axis. For example, given the matrix:: >>> a2d = np.zeros((3, 3), dtype=int) >>> a2d[1, 1] = 1 >>> a2d = np.ma.masked_equal(a2d, 1) >>> print(a2d) [[0 0 0] [0 -- 0] [0 0 0]] The API allows:: >>> pr

Re: [Numpy-discussion] Adding an nd generalization of np.ma.mask_rowscols

2020-01-17 Thread Sebastian Berg
On Fri, 2020-01-17 at 10:39 +, Eric Wieser wrote: > Today, numpy has a np.ma.mask_rowcols function, which stretches masks > along > the full length of an axis. For example, given the matrix:: > > Questions for the mailing list then: > The additional question: I think I am good with adding

Re: [Numpy-discussion] Adding an nd generalization of np.ma.mask_rowscols

2020-01-17 Thread Hameer Abbasi
IMHO, masked arrays and extending masks like that is a weird API. I would prefer a more functional approach: Where we take in an input 1-D or N-D boolean array in addition to a masked array with multiple axes over which to extend the mask. From: NumPy-Discussion on behalf of Eric Wieser Rep

Re: [Numpy-discussion] Adding an nd generalization of np.ma.mask_rowscols

2020-01-17 Thread Eric Wieser
IMHO, masked arrays and extending masks like that is a weird API. To give some context, I needed this nd generalization internally in order to fix the issue on these lines . I would prefer