JAE_RYONG
JAE_RYONG

Reputation: 131

Changing the structure of np.array in Python

I have the following array structure.

array([[ 0.3, 0.1, 0. , 1. , 0. , 0. , 2.7], [ 0.5, 0.5, 0. , 0. , 1. , 0. , 6. ], [ 0.6, 0.4, -1. , 0. , 0. , 1. , 6. ]])

How can I change to the following structure?

array([[ 0.3, 0.1, 0. , 1. , 2.7], [ 0.5, 0.5, 0. , 0. , 6. ], [ 0.6, 0.4, -1. , 0. , 6. ]])

Upvotes: 0

Views: 130

Answers (1)

meW
meW

Reputation: 3967

Assuming array is stored in a variable arr use indexing:

arr[:,[0, 1, 2, 3, 6]]

Upvotes: 2

Related Questions