np.array_repr fails on np.matrix objects
See original GitHub issueCause of #5875:
>>> np.array_repr(np.eye(2).view(np.matrix))
Traceback (most recent call last):
File "<pyshell#52>", line 1, in <module>
np.array_repr(np.matrix(np.eye(2)))
File "C:\Program Files\Python 3.5\lib\site-packages\numpy\core\numeric.py", line 1807, in array_repr
', ', "array(")
File "C:\Program Files\Python 3.5\lib\site-packages\numpy\core\arrayprint.py", line 447, in array2string
separator, prefix, formatter=formatter)
File "C:\Program Files\Python 3.5\lib\site-packages\numpy\core\arrayprint.py", line 325, in _array2string
_summaryEdgeItems, summary_insert)[:-1]
File "C:\Program Files\Python 3.5\lib\site-packages\numpy\core\arrayprint.py", line 519, in _formatArray
summary_insert)
File "C:\Program Files\Python 3.5\lib\site-packages\numpy\core\arrayprint.py", line 496, in _formatArray
word = format_function(a[-1])
File "C:\Program Files\Python 3.5\lib\site-packages\numpy\core\arrayprint.py", line 598, in __call__
if isnan(x):
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
Spot the x[i].shape == x.shape[1:]
fallacy…
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
python - How can a string representation of a NumPy array be ...
The only things that I call in my code are array , repr , eval , and all . The fact that you're...
Read more >numpy.array_repr — NumPy v1.23 Manual
Return the string representation of an array. Parameters. arrndarray. Input array. max_line_widthint, optional. Inserts newlines if text is ...
Read more >6 Key differences between np.ndarray and np.matrix objects
We can use np.array() function to create an ndarray object. import numpy as npA ... If we try to create a 3d matrix,...
Read more >Difference between Numpy array and Numpy matrix
The Numpy array object in Numpy is called ndarray. We can create ndarray using numpy.array() function. It is used to convert a list,...
Read more >Sparse matrices (scipy.sparse) — SciPy v1.9.3 Manual
This package is switching to an array interface, compatible with NumPy arrays, from the older matrix interface. We recommend that you use the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
At some point we should deprecate matrices and be done with them. After all, the most likely users are newbies and they should be encouraged to use Python 3.5 and later now that there is the
@
operator.Ugh, @rgommers is right, I forgot about
scipy.sparse
.