rolling_tanh

czsc.rolling_tanh(df: DataFrame, col: str, window=300, min_periods=100, new_col=None, **kwargs)[source]

对序列进行滚动 tanh 变换

双曲正切函数:https://baike.baidu.com/item/%E5%8F%8C%E6%9B%B2%E6%AD%A3%E5%88%87%E5%87%BD%E6%95%B0/15469414

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

  • col – str, 待计算的列

  • window – int, 滚动窗口大小, 默认为300

  • min_periods – int, 最小计算周期, 默认为100

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