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

polyval turns masked array into array (Trac #1884) #2477

Closed
numpy-gitbot opened this issue Oct 19, 2012 · 3 comments · Fixed by #12239
Closed

polyval turns masked array into array (Trac #1884) #2477

numpy-gitbot opened this issue Oct 19, 2012 · 3 comments · Fixed by #12239

Comments

@numpy-gitbot
Copy link

Original ticket http://projects.scipy.org/numpy/ticket/1884 on 2011-06-28 by trac user mauro, assigned to @pierregm.

When using a masked array as input for polyval, then the return is an array. I think it should be a masked array again (or at least document it that it is not).

The fix seems easy, remove the line
x = NX.asarray(x)
from np.lib.polyval. But presumably that line is there for a reason...

@numpy-gitbot
Copy link
Author

Attachment added by trac user mauro on 2011-06-28: masked_and_polyfit.py

@charris
Copy link
Member

charris commented Feb 20, 2014

Using x = NX.asanyarray(x) fixes this. The rest of the functions also need checking to see if there are other places where that is appropriate.

sudheesh001 added a commit to sudheesh001/numpy that referenced this issue Dec 27, 2015
jhereth pushed a commit to jhereth/numpy that referenced this issue Oct 21, 2018
This fix will preserve subtypes of ndarray when given as input (x)
to the polyval function. In particular, the results for masked
values of a masked array will be masked.

Fixes numpy#2477.
@jhereth
Copy link

jhereth commented Oct 21, 2018

I found the abandoned PR #6891 by @sudheesh001 and followed the review from @ahaldane.

#12239 is the result.

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

Successfully merging a pull request may close this issue.

4 participants