SciPy

scipy.sparse.dok_matrix.shape

dok_matrix.shape