numpy找到数组中符合条件的数
import numpy as np
arr = np.array([1, 1, 1, 134, 45, 3, 46, 45, 65, 3, 23424, 234, 12, 12, 3, 546, 1, 2])
print(arr[arr > 3])
Output:
[ 134 45 46 45 65 23424 234 12 12 546]
参考 https://blog.youkuaiyun.com/blackyuanc/article/details/77948703

这篇博客介绍了如何利用numpy库在Python中查找数组中满足特定条件的数值,通过实例详细阐述了筛选过程。
566

被折叠的 条评论
为什么被折叠?



