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.
You are looking for the function matrix.get_shape()
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.