The following code generated an unexpected TypeError
:
import scipy.sparse
import numpy
coomatrix = scipy.sparse.coo_matrix((100,100))
numpy.sum(coomatrix)
the result:
TypeError: sum() got an unexpected keyword argument 'dtype'
scipy
version 0.14.0, numpy
version 1.9.0
The problem is that numpy.sum
doesn't know how to handle sparse matrices. The following works as expected:
coomatrix.sum()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With