-
-
Notifications
You must be signed in to change notification settings - Fork 10.9k
.format does not play well with a 0-D NumPy array #7978
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
Comments
Just ran into this as well. This is quite bad, isn't it? |
Not as bad as using a 0-D NumPy array in the first place :P But yeah, this should be fixed. |
0D arrays are a standard output in xarray: In [1]: import xarray as xr
In [2]: '{:.2g}'.format(xr.DataArray([1, 2, 3]).mean())
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-2-e521944932df> in <module>()
----> 1 '{:.2g}'.format(xr.DataArray([1, 2, 3]).mean())
TypeError: non-empty format string passed to object.__format__ (CC @shoyer just fyi) |
eric-wieser
added a commit
to eric-wieser/numpy
that referenced
this issue
Oct 18, 2017
This fixes numpygh-7978 The behavior for other sized arrays is left unchanged, pending discussion in numpygh-5543
theodoregoetz
pushed a commit
to theodoregoetz/numpy
that referenced
this issue
Oct 23, 2017
This fixes numpygh-7978 The behavior for other sized arrays is left unchanged, pending discussion in numpygh-5543
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
Is this a bug?
The text was updated successfully, but these errors were encountered: