I have a very large numpy array like this. How can I convert this into
array([[1, 1, 0, 0, 1, 0, 0, 1],
[0, 1, 0, 0, 0, 1, 0, 0],
[0, 0, 1, 0, 1, 1, 0, 0],
[0, 0, 1, 0, 1, 1, 0, 0],
[0, 0, 1, 1, 0, 1, 1, 0],
[0, 0, 1, 1, 0, 1, 1, 0]])
into this every two rows into one row? Although I need every four rows as one row? This example would be helpful! I searched many places couldn't find a proper solution!
array([[1, 1, 0, 0, 1, 0, 0, 1 , 0, 1, 0, 0, 0, 1, 0, 0],
[0, 0, 1, 0, 1, 1, 0, 0 , 0, 0, 1, 0, 1, 1, 0, 0],
[0, 0, 1, 1, 0, 1, 1, 0 , 0, 0, 1, 1, 0, 1, 1, 0]])
and then back again to
array([[1, 1, 0, 0, 1, 0, 0, 1],
[0, 1, 0, 0, 0, 1, 0, 0],
[0, 0, 1, 0, 1, 1, 0, 0],
[0, 0, 1, 0, 1, 1, 0, 0],
[0, 0, 1, 1, 0, 1, 1, 0],
[0, 0, 1, 1, 0, 1, 1, 0]])