1 Star 4 Fork 11

王布衣 / pandas

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
slope.go 407 Bytes
一键复制 编辑 原始数据 按行查看 历史
王布衣 提交于 2024-02-12 22:35 . 调整包路径
package formula
import (
"gitee.com/quant1x/num"
"gitee.com/quant1x/pandas"
)
// SLOPE 计算周期回线性回归斜率
//
// SLOPE(S,N) 返回线性回归斜率,N支持变量
func SLOPE(S pandas.Series, N any) any {
return S.Rolling(N).Apply(func(X pandas.Series, W num.DType) num.DType {
x := X.DTypes()
w := num.Range[num.DType](len(x))
c := num.PolyFit(w, x, 1)
return c[0]
}).Values()
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/quant1x/pandas.git
git@gitee.com:quant1x/pandas.git
quant1x
pandas
pandas
v1.4.8

搜索帮助

344bd9b3 5694891 D2dac590 5694891