Reputation: 3
I want to know the co
import numpy as np
a = np.array([[0,0,0,2,3,0],[3,2,4,0,0,1]])
If I want to get col2 to col4, so result may be:
[[0,2,3][4,0,0]]
How can I make it? Thanks.
Upvotes: 0
Views: 94
Reputation: 369394
>>> import numpy as np
>>> a = np.array([[0,0,0,2,3,0],[3,2,4,0,0,1]])
>>> a[:,2:5]
array([[0, 2, 3],
[4, 0, 0]])
Upvotes: 1