-
-
Notifications
You must be signed in to change notification settings - Fork 10.9k
Support for float hex format for matrix() #18060
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
It's worth noting that
That's not creating an array at all, that's just a single string inside a 0-d Array, hence the
|
My case is having file with arrays in the text file which needs to be loaded (I'm aware of .npy format). So wrapping np.array() around np.matrix() works fine, e.g.
However I'd like to load arrays from the text file which I've written in the hex format (dumped with
but this generates the SyntaxError. |
I agree with @eric-wieser here, especially since the hex float repr isn't valid Python syntax: as pointed out above, this is not something that is works with |
Uh oh!
There was an error while loading. Please reload this page.
Similar to #5504,
np.matrix
should be able to interpret float hex format.So this works fine:
>>> np.matrix("[1.1 1.2 1.3 1.4]") matrix([[1.1, 1.2, 1.3, 1.4]])
Also the following array of hexes works fine using
np.array()
:However
np.matrix()
fails to interpret it:My version:
>>> np.__version__ '1.19.4'
The text was updated successfully, but these errors were encountered: