Using numpy, how is it possible to take the array
np.array([[1,2,3],[4,5,6],[7,8,9]])
and get out the arrays
[1,4,7] and [[2,3],[5,6],[8,9]]
Using numpy, how is it possible to take the array
np.array([[1,2,3],[4,5,6],[7,8,9]])
and get out the arrays
[1,4,7] and [[2,3],[5,6],[8,9]]
You can use indexing as such :
In [9]: a = np.array([[1,2,3],[4,5,6],[7,8,9]])
In [10]: a[:,0]
Out[10]: array([1, 4, 7])
In [11]: a[:,1:]
Out[11]:
array([[2, 3],
[5, 6],
[8, 9]])