-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
BUG: Applying np.fix on scalar returns 0-D array #8993
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
Labels
Comments
Seems pretty dumb that that function:
Should be a trivial fix, changing the code to: x = nx.asanyarray(x)
y1 = nx.floor(x)
y2 = nx.ceil(x)
res = nx.where(x >= 0, y1, y2)
if y is not None:
### todo: deprecate here
y[...] = res
return y
return res |
Note that whatever fix is applied here, it should be applied to every function within that file - they all suffer from the same problem |
Hmm - this is maybe a bug in |
eric-wieser
added a commit
to eric-wieser/numpy
that referenced
this issue
Apr 26, 2017
No need to reinvent the wheel here - the ufunc machinery will handle the out arguments Fixes numpy#8993
mherkazandjian
pushed a commit
to mherkazandjian/numpy
that referenced
this issue
May 30, 2017
No need to reinvent the wheel here - the ufunc machinery will handle the out arguments Fixes numpy#8993
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Appears that when NumPy's
fix
function is given a scalar, it returns a 0-D array as the result. However, the documentation clearly shows it returning a scalar when given a scalar. Either this is a bug or the documentation needs to be updated. IMHO having a scalar returned when giving a scalar seems desirable. Example code andconda
environment details below.Code sample:
Environment:
Note: Sorry if this is a duplicate issue. Searching the issue tracker for "fix" was not very effective.
The text was updated successfully, but these errors were encountered: