Suppose I have a NumPy 2D array A:
>>> import numpy as np
>>> A=np.arange(30).reshape(3,10)
>>> A
array([[ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
[10, 11, 12, 13, 14, 15, 16, 17, 18, 19],
[20, 21, 22, 23, 24, 25, 26, 27, 28, 29]])
I need to get two arrays B and C with the following properties:
B = array([[ 0, 3, 4, 5, 6, 7, 8, 9],
[10, 13, 14, 15, 16, 17, 18, 19],
[20, 23, 24, 25, 26, 27, 28, 29]])
C = array([[ 1, 2],
[11, 12],
[21, 22]])
What is the easiest way to accomplish this?
Note that I have to get all sets of C (2 adjacent columns) and B (which is A without C). I tried different NumPy constructs like np.delete, np.hstack but nothing seem to work at the corner conditions like in the above example.