简体   繁体   中英

how to find the dimension of a CSR matrix in Python

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.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM