I would like to know the best way to check if a scipy sparse matrix, if CSC or CSR. Right now I'm using.
rows, cols = X.shape()
indptr = X.indptr()
if len(indptr) == cols + 1:
print "csc"
else:
print "csr"
Thanks.
It looks like you could use the .getformat() method:
>>> m0 = scipy.sparse.csc_matrix([1])
>>> m0.getformat()
'csc'
>>> m1 = scipy.sparse.csr_matrix([1])
>>> m1.getformat()
'csr'
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