简体   繁体   中英

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. ]])

假设数组存储在变量arr使用索引:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM