[Python] how to find the dimension of a CSR matrix in Python

Discussão em 'Python' iniciado por Stack, Janeiro 18, 2025.

  1. Stack

    Stack Membro Participativo

    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.

    Continue reading...

Compartilhe esta Página