在 Python 列表中,我需要计算超出某个值的次数。
此代码计算有多少值超出了限制。假设我有这个例子,我想计算2超过了多少时间。
2
array = [1, 2, 3, 4, 1, 2, 3, 1] a = pd.Series(array) print(len(a[a >= 2])) # prints 5
如何折叠连续的值,2而是返回?
python numpy time-series python-3.x pandas
numpy ×1
pandas ×1
python ×1
python-3.x ×1
time-series ×1