I have a 3D NumPy array that I want to convert to a 3D sparse matrix in Python. I looked up scipy.sparse
module and only found 2D sparse matrix implementations. For example,
Input:
array([[[0],
[0],
[1],
[0],
[1],
[0],
[0]],
[[1],
[0],
[1],
[0],
[0],
[0],
[0]]])
Output:
(0,0,2) 1
(0,0,4) 1
(0,1,0) 1
(0,1,2) 1
How would do this?