rolling_rank

czsc.rolling_rank(df: DataFrame, col, n=None, new_col=None, **kwargs)[source]

计算序列的滚动排名

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

  • col – str 待计算的列

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

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

  • kwargs

    min_periods: int

    最小计算周期