I want to split numpy array based on columns if all values of column are zero. If sequence of columns has only 0 like first two columns of sample array, this group should discard.
Is there any efficient solution?
Sample input numpy array:
[[0. 0. 0. 255. 0. 255. 0. 0. 0. ]
[0. 0. 0. 255. 0. 255. 0. 0. 0. ]
[0. 0. 0. 255. 0. 255. 255. 0. 0. ]
[0. 0. 255. 255. 0. 0. 0. 0. 255.]
[0. 0. 0. 255. 0. 255. 0. 0. 0. ]
[0. 0. 0. 255. 0. 255. 0. 0. 0. ]
[0. 0. 0. 255. 0. 255. 0. 0. 0. ]
]
Expected output numpy array:
[[
[0. 255.]
[0. 255.]
[0. 255.]
[255. 255.]
[0. 255.]
[0. 255.]
[0. 255.]
]
[
[255. 0. ]
[255. 0. ]
[255. 255.]
[0. 0. ]
[255. 0. ]
[255. 0. ]
[255. 0. ]
]
[
[0. ]
[0. ]
[0. ]
[255.]
[0. ]
[0. ]
[0. ]
]
]
shape()be?