【发布时间】:2021-05-11 20:38:18
【问题描述】:
我正在从传感器读取数据,它的数据总是随时间变化,它的数据在 0 到 255 之间,如 np.array。
我想找到 3 到 250 之间的最小值和最大值。
例如:
import numpy as np
a = np.array([0,1, 2, 10, 20, 100, 251, 255])
d = a.min()
c = a.max()
print (d,c)
输出为:(0, 255)
我想成为(10, 100)
有时a = np.array([0,1, 3, 10, 20, 100, 249, 255])
我想成为(3, 249)
请帮忙。
【问题讨论】:
-
为什么最大 100 和 249?而不是 255?
-
@SayanipDutta,我想找到 3 到 250 之间的最小值和最大值。
标签: python arrays numpy max min