Numpy笔记
where函数
语法
numpy.where(condition, [x, y]) |
condition是一个数组
x和y是可选的
例子
- 只使用
condition参数
import numpy as np |
- 加上
x和y的参数,小于等于25的元素为-1
# 使用np.where函数找出数组中大于25的元素 |
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 玩转代码:探索奇妙之地!
numpy.where(condition, [x, y]) |
condition是一个数组
x和y是可选的
condition参数import numpy as np |
x和y的参数,小于等于25的元素为-1# 使用np.where函数找出数组中大于25的元素 |