scipy.sparse.dok_matrix.getnnz
scipy.sparse.dok_matrix.has_key
Returns a copy of row i of the matrix as a (1 x n) DOK matrix.