Skip to content
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

data types in csr matrix #493

Closed
annonch opened this issue Oct 9, 2019 · 2 comments
Closed

data types in csr matrix #493

annonch opened this issue Oct 9, 2019 · 2 comments

Comments

@annonch
Copy link

annonch commented Oct 9, 2019

Curiously using example code from the link in A2

The expected behavior differs from observed. Using int64 does not print the dtype information however int8 does.

Am I missing something?

>>> from scipy.sparse import *
>>> from scipy import *
>>> csr_matrix((3,4),dtype='int64').toarray()
array([[0, 0, 0, 0],
       [0, 0, 0, 0],
       [0, 0, 0, 0]])                                                            # Error
>>> csr_matrix((3,4),dtype='int8').toarray()
array([[0, 0, 0, 0],
       [0, 0, 0, 0],
       [0, 0, 0, 0]], dtype=int8)                                             # no error
>>> import numpy as np
>>> csr_matrix((3,4),dtype=np.int64).toarray()
array([[0, 0, 0, 0],
       [0, 0, 0, 0],
       [0, 0, 0, 0]])
@aronwc
Copy link
Member

aronwc commented Oct 10, 2019 via email

@annonch
Copy link
Author

annonch commented Oct 10, 2019

Okay, just that my test for 'vectorize' will fail... My guess is platform dependency or version number.. Anyone else see this for osx? I use ports to install everything and pip for python packages.

@annonch annonch closed this as completed Oct 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants