1 Star 0 Fork 11

谋决量化 / go_pandas

forked from 王布衣 / pandas 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
series_diff_test.go 820 Bytes
一键复制 编辑 原始数据 按行查看 历史
package pandas
import (
"fmt"
"gitee.com/quant1x/pandas/stat"
"testing"
)
func TestNDFrame_Diff(t *testing.T) {
d1 := []float64{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}
s1 := NewNDFrame[float64]("x", d1...)
df := NewDataFrame(s1)
fmt.Println(df)
fmt.Println("------------------------------------------------------------")
N := 1
fmt.Println("固定的参数, N =", N)
r1 := df.Col("x").Diff(N).Values()
fmt.Println("序列化结果:", r1)
fmt.Println("------------------------------------------------------------")
d2 := []float64{1, 2, 3, 4, 3, 3, 2, 1, stat.Nil2Float64, stat.Nil2Float64, stat.Nil2Float64, stat.Nil2Float64}
s2 := NewSeries(stat.SERIES_TYPE_FLOAT64, "x", d2)
fmt.Printf("序列化参数: %+v\n", s2.Values())
r2 := df.Col("x").Diff(s2).Values()
fmt.Println("序列化结果:", r2)
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/moujue/go_pandas.git
git@gitee.com:moujue/go_pandas.git
moujue
go_pandas
go_pandas
master

搜索帮助

344bd9b3 5694891 D2dac590 5694891