赞
踩
import numpy as np
A=np.array([[1,3,5],[2,4,6],[9,8,7]])
print(np.where(A==1))
(array([0], dtype=int64), array([0], dtype=int64))
print(np.where(A==2))
(array([1], dtype=int64), array([0], dtype=int64))
A=np.array([[1,3,5],[2,4,6],[9,2,7]])
print(np.where(A==2))
(array([1, 2], dtype=int64), array([0, 1], dtype=int64))
A=np.array([[1,3,2],[2,4,6],[9,2,7]])
print(np.where(A==2))
(array([0, 1, 2], dtype=int64), array([2, 0, 1], dtype=int64))
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。