Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. In [916]: alist=[sparse.random(1,10,.2, format='csr') for _ in range(3)]
  2. In [917]: alist
  3. Out[917]:
  4. [<1x10 sparse matrix of type '<class 'numpy.float64'>'
  5. with 2 stored elements in Compressed Sparse Row format>,
  6. <1x10 sparse matrix of type '<class 'numpy.float64'>'
  7. with 2 stored elements in Compressed Sparse Row format>,
  8. <1x10 sparse matrix of type '<class 'numpy.float64'>'
  9. with 2 stored elements in Compressed Sparse Row format>]
  10.  
  11. In [918]: sparse.vstack(alist)
  12. Out[918]:
  13. <3x10 sparse matrix of type '<class 'numpy.float64'>'
  14. with 6 stored elements in Compressed Sparse Row format>
  15.  
  16. In [919]: np.array(alist)
  17. Out[919]:
  18. array([ <1x10 sparse matrix of type '<class 'numpy.float64'>'
  19. with 2 stored elements in Compressed Sparse Row format>,
  20. <1x10 sparse matrix of type '<class 'numpy.float64'>'
  21. with 2 stored elements in Compressed Sparse Row format>,
  22. <1x10 sparse matrix of type '<class 'numpy.float64'>'
  23. with 2 stored elements in Compressed Sparse Row format>], dtype=object)
  24.  
  25. In [920]: np.array(alist, float)
  26. ---------------------------------------------------------------------------
  27. ValueError Traceback (most recent call last)
  28. <ipython-input-920-52d4689fa7b3> in <module>()
  29. ----> 1 np.array(alist, float)
  30.  
  31. ValueError: setting an array element with a sequence.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement