是的,在给定
NumPy数组
array和值的情况下,这是搜索的答案
item:
itemindex = numpy.where(array==item)
结果是具有所有行索引,然后是所有列索引的元组。
例如,如果一个数组是二维的,并且它在两个位置包含你的商品,则
array[itemindex[0][0]][itemindex[1][0]]
将等于你的项目,因此
array[itemindex[0][1]][itemindex[1][1]]

是的,在给定
NumPy数组
array和值的情况下,这是搜索的答案
item:
itemindex = numpy.where(array==item)
结果是具有所有行索引,然后是所有列索引的元组。
例如,如果一个数组是二维的,并且它在两个位置包含你的商品,则
array[itemindex[0][0]][itemindex[1][0]]
将等于你的项目,因此
array[itemindex[0][1]][itemindex[1][1]]