rolling_compare

czsc.rolling_compare(df, col1, col2, new_col=None, n=None, **kwargs)[source]

计算序列的滚动归一化值

Parameters:
  • df – pd.DataFrame 待计算的数据

  • col1 – str 第一个列名

  • col2 – str 第二个列名

  • n – int 滚动窗口大小, 默认为None, 表示计算 expanding ,否则计算 rolling

  • new_col – str 新列名,默认为 None, 表示使用 f’{col}_norm’ 作为新列名

  • kwargs

    min_periods: int

    最小计算周期