SciPy

scipy.sparse.dok_matrix.keys

dok_matrix.keys() → a set-like object providing a view on D's keys