更新时间:2023-02-19 11:05:13
是的,这里是给予numpy的数组,数组的答案,和值,物品,以进行搜索。
Yes, here is the answer given a Numpy array, array, and a value, item, to search for.
itemindex = numpy.where(array==item)
的结果是一个元组与第一所有的行指数,那么所有的列索引
The result is a tuple with first all the row indices, then all the column indices.
例如,如果数组为两个维度,它在两个位置包含在您的项目,然后
For example if array is two dimensions and it contained your item at two locations then
array[itemindex[0][0]][itemindex[1][0]]
将等于您的项目,因此会
would be equal to your item and so would
array[itemindex[0][1]][itemindex[1][1]]