参考链接: Python中的numpy.place
注意: df1.where(cond,df2) 等价于 np.where(cond, df1, df2)
1. pandas.DataFrame.where...(condition[, x, y]) 功能: 参数: condition: 判定条件,如果True,选择 x;False,选择y(数据类型为数组,bool 值)x,y(可选): x 和 y 的 shape...必须和 condition 相同(可以采用 broadcast,广播机制) ①如果参数有condition,x和y,它们三个参数的shape是相同的。...那么,当condition中的值是true时返回x对应位置的值,false是返回y的。...(x>5) # ndarray 数组分别表示对应的 行和列
(array([2, 2, 2], dtype=int64), array([0, 1, 2], dtype=int64))
https