Python np.where

原文:https://www.cnblogs.com/gezhuangzhuang/p/10724769.html
import numpy as np


x = np.arange(9.).reshape(3, 3)
print(x)
print(np.where(x > 5))

# np.arange(9.).reshape(3, 3) 表示为
# 0 1 2
# 3 4 5
# 6 7 8

# np.where(x > 5)
# 6 7 8

# 换成真实的坐标:
# (2,0) (2,1) (2,2)

# np.where 返回的结果 会把真实的坐标搞反 格式:(col,row) 或 (列,行)
# (0,2) (1,2) (2,2)

简单理解

原文地址:https://www.cnblogs.com/guxingy/p/12200116.html