Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- In [916]: alist=[sparse.random(1,10,.2, format='csr') for _ in range(3)]
- In [917]: alist
- Out[917]:
- [<1x10 sparse matrix of type '<class 'numpy.float64'>'
- with 2 stored elements in Compressed Sparse Row format>,
- <1x10 sparse matrix of type '<class 'numpy.float64'>'
- with 2 stored elements in Compressed Sparse Row format>,
- <1x10 sparse matrix of type '<class 'numpy.float64'>'
- with 2 stored elements in Compressed Sparse Row format>]
- In [918]: sparse.vstack(alist)
- Out[918]:
- <3x10 sparse matrix of type '<class 'numpy.float64'>'
- with 6 stored elements in Compressed Sparse Row format>
- In [919]: np.array(alist)
- Out[919]:
- array([ <1x10 sparse matrix of type '<class 'numpy.float64'>'
- with 2 stored elements in Compressed Sparse Row format>,
- <1x10 sparse matrix of type '<class 'numpy.float64'>'
- with 2 stored elements in Compressed Sparse Row format>,
- <1x10 sparse matrix of type '<class 'numpy.float64'>'
- with 2 stored elements in Compressed Sparse Row format>], dtype=object)
- In [920]: np.array(alist, float)
- ---------------------------------------------------------------------------
- ValueError Traceback (most recent call last)
- <ipython-input-920-52d4689fa7b3> in <module>()
- ----> 1 np.array(alist, float)
- ValueError: setting an array element with a sequence.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement