numpy 花式索引

numpy 的花式索引 numpy的花式索引方式有不少种,特别是多维度索引的状况下比较绕,须要理解清楚。html 一维的花式索引,i数组的值对应的就是a数组的索引,这样输出了一个新的数组 # input import numpy as np a = np.arange(12) ** 2 i = np.array([1, 1, 3, 8, 5]) print(a[i]) # output [ 1
相关文章
相关标签/搜索