Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support masked arrays for np.insert #6079

Open
ocehugo opened this issue Jul 15, 2015 · 1 comment
Open

support masked arrays for np.insert #6079

ocehugo opened this issue Jul 15, 2015 · 1 comment

Comments

@ocehugo
Copy link

ocehugo commented Jul 15, 2015

Currently np.insert do not follow the masked rules of a np.ma.Maskedarray.

How to Reproduce:

import numpy as np
a=np.ma.masked_array([1,0],[0,1])
b=np.insert(a,len(a),np.ma.masked_array([0,1],[1,0]),axis=0)
len(b.mask)

outputs:

object of type 'numpy.bool_' has no len()

So the insert function doens't take the mask in account even if the input is masked. The same behaviour occurs when input is not masked, so the operation causes a lost of the masking information ( it would be desirable that even in this case the output would be at least not masked and the operation would preserve the mask information).

I believed that the mask information would be passthrough to the new array.

@OmerJog
Copy link

OmerJog commented Nov 13, 2019

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants