show_ts_rolling_corr

czsc.show_ts_rolling_corr(df, col1, col2, **kwargs)[source]

时序上按 rolling 的方式计算相关系数

Parameters:
  • df – pd.DataFrame, 必须包含列 dt 和 col1, col2

  • col1 – str, df 中的列名

  • col2 – str, df 中的列名

  • kwargs

    • min_periods: int, 最小滑动窗口长度

    • window: int, 滑动窗口长度,0 表示按 expanding 方式滑动

    • corr_method: str, 相关系数计算方法,可选 pearson, kendall, spearman

    • sub_title: str, 子标题