Reputation: 2870
I have a tfidf
matrix of type scipy.sparse.csr.csr_matrix
How do I find the number of rows and number of columns of it in Python 3?
I tried converting it to a dense one and then finding the length of a row like this
len(tfidf_matrix.todense())
but it outputs 1 which is not right.
Upvotes: 0
Views: 6393
Reputation: 6911
In the latest version of scipy, shape
is changed from a function to an attribute of csr_matrix.
https://docs.scipy.org/doc/scipy-1.15.0/reference/generated/scipy.sparse.csr_matrix.shape.html
Upvotes: 0