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

masked values not converted to nan when slicing #8460

Open
gerritholl opened this issue Jan 10, 2017 · 0 comments
Open

masked values not converted to nan when slicing #8460

gerritholl opened this issue Jan 10, 2017 · 0 comments
Labels
component: numpy.ma masked arrays

Comments

@gerritholl
Copy link
Contributor

Closely related to #4592, when a slice containing masked values is assigned to an unmasked float array, the underlying data are copied, but masked elements are not converted to nan:

In [289]: A = arange(5, dtype="f2")

In [290]: fm = ma.masked_array([1.0, 2.0, 3.0, 4.0], [True, False, True, False])

In [291]: A[0] = fm[0]
/dev/shm/gerrit/venv/stable-3.5/bin/ipython3:1: UserWarning: Warning: converting a masked element to nan.
  #!/dev/shm/gerrit/venv/stable-3.5/bin/python3.5

In [292]: print(A)
[ nan   1.   2.   3.   4.]

In [293]: A[:4] = fm[:4]

In [294]: print(A)
[ 1.  2.  3.  4.  4.]
@eric-wieser eric-wieser added the component: numpy.ma masked arrays label Feb 19, 2017
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

2 participants