SciPy

scipy.sparse.dok_matrix.viewkeys

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