SciPy

scipy.sparse.dok_matrix.shape

property dok_matrix.shape

Get shape of a matrix.