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

Copy and deepcopy of np.ma.masked returns np.ma.array() #11021

Closed
taldcroft opened this issue Apr 30, 2018 · 2 comments
Closed

Copy and deepcopy of np.ma.masked returns np.ma.array() #11021

taldcroft opened this issue Apr 30, 2018 · 2 comments
Labels
component: numpy.ma masked arrays

Comments

@taldcroft
Copy link

I would expect that copy or deepcopy of np.ma.masked would give me the same object, but this doesn't appear to be the case:

In [9]: copy.deepcopy(np.ma.masked)
Out[9]: 
masked_array(data=--,
             mask=True,
       fill_value=1e+20,
            dtype=float64)

In [10]: copy.copy(np.ma.masked)
Out[10]: 
masked_array(data=--,
             mask=True,
       fill_value=1e+20,
            dtype=float64)

In [11]: type(copy.deepcopy(np.ma.masked))
Out[11]: numpy.ma.core.MaskedArray

In [12]: type(np.ma.masked)
Out[12]: numpy.ma.core.MaskedConstant

In [13]: np.__version__
Out[13]: '1.14.2'
@eric-wieser
Copy link
Member

Should be an easy fix - just implement __copy__ and __deepcopy__ on MaskedConstant

@Krithi07
Copy link
Contributor

Krithi07 commented May 2, 2018

I am newbie and would like to take a stab at it if nobody is working on it already

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: numpy.ma masked arrays
Projects
None yet
Development

No branches or pull requests

3 participants