我有一个NumPy数组:
[[ 0. 1. 2. 3. 4.]
[ 7. 8. 9. 10. 4.]
[ 14. 15. 16. 17. 4.]
[ 1. 20. 21. 22. 23.]
[ 27. 28. 1. 20. 29.]]
我希望快速找到特定值的坐标而避免在数组上使用Python循环。例如数字4
在:
row 0 and col 4
row 1 and col 4
row 2 and col 4
搜索功能应返回一个元组:
((0,4),(1,4),(2,4))
能否直接使用NumPy函数完成此操作?
np.where(a)
。" - JoshAdel.where
。 - Ηλίας