Convert Sparse Matrix To Numpy Function Python Code