Convert Sparse Matrix To Numpy Function Python