rolling_window_stat
描述
计算时间序列在指定时间窗口内向后滚动的统计量。 对于每个时间点,计算该点之后指定时间窗口内所有数据的指定统计量。
函数签名
rolling_window_stat(times, values, window, stat_type, include_current) -> None
参数
times
(array_like)
时间戳数组(单位:秒)
values
(array_like)
数值数组
window
(float)
时间窗口大小(单位:秒)
stat_type
(str)
统计量类型,可选值: - "mean": 均值 - "sum": 总和 - "max": 最大值 - "min": 最小值 - "last": 时间窗口内最后一个值 - "std": 标准差 - "median": 中位数 - "count": 数据点数量 - "rank": 分位数(0到1之间) - "skew": 偏度 - "trend_time": 与时间序列的相关系数 - "last": 时间窗口内最后一个值 - "trend_oneton": 与1到n序列的相关系数(时间间隔)
返回值
numpy.ndarray 计算得到的向后滚动统计量数组
Python调用示例: ```python import numpy as np from rust_pyfunc import rolling_window_stat
创建示例数据
times = np.array([0.0, 1.0, 2.0, 3.0, 4.0]) values = np.array([1.0, 2.0, 3.0, 4.0, 5.0]) window = 2.0 # 2秒的时间窗口
计算向后滚动均值
mean_result = rolling_window_stat(times, values, window, "mean") ```
示例
暂无示例
Python使用示例
import numpy as np
from rust_pyfunc import rolling_window_stat
# 使用示例
# 请参考文档中的参数说明使用此函数