1

I am trying to select all elements except one column from a multidimensional array.

I think it's something like this: blah[:,[1,]]

So if the array was: [[1,2,3],[4,5,6]]

I want to get: [[2,3],[5,6]]

0

2 Answers 2

2
In [8]: ar = np.array([[1,2,3], [4,5,6]])

In [9]: ar
Out[9]: 
array([[1, 2, 3],
       [4, 5, 6]])

In [11]: ar[:, 1:]
Out[11]: 
array([[2, 3],
       [5, 6]])
Sign up to request clarification or add additional context in comments.

Comments

2

I suggest you use this:

a = [[1,2,3],[4,5,6]]
res = [sub[1:] for sub in a]

Hope it works!

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.