代码拉取完成,页面将自动刷新
同步操作将从 王布衣/pandas 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
package pandas
import (
"bytes"
"encoding/json"
"fmt"
"strings"
"testing"
)
func TestCsv(t *testing.T) {
csvStr := `
Country,Date,Age,Amount,Id,close
"United States",2012-02-01,50,112.1,01234,1.231111
"United States",2012-02-01,32,321.31,54320,1.232222
"United Kingdom",2012-02-01,17,18.2,12345,1.233333
"United States",2012-02-01,32,321.31,54320,1.234444
"United Kingdom",2012-02-01,NA,18.2,12345,1.235555
"United States",2012-02-01,32,321.31,54320,1.236666
"United States",2012-02-01,32,321.31,54320,1.237777
Spain,2012-02-01,66,555.42,00241,1.23
`
df := ReadCSV(strings.NewReader(csvStr))
fmt.Println(df)
filename := "./testfiles/test-tutorials-w01.csv"
_ = df.WriteCSV(filename)
buf := new(bytes.Buffer)
_ = df.WriteCSV(buf)
df = ReadCSV(filename)
fmt.Println(df)
_ = df.SetNames("a", "b", "c", "d", "e", "f")
fmt.Println(df)
//s1 := df.Col("d")
//fmt.Println(s1)
//
closes := df.Col("d")
ma5 := closes.Rolling(5).Mean()
//dframe.NewSeriesV2(closes, dframe.Float32s, "")
fmt.Println(ma5)
d := df.Col("d")
fmt.Println(d)
_ = csvStr
}
type T1 struct {
X []int64 `json:"x"`
}
func TestEwm(t *testing.T) {
//a := make(map[string][]int, 8)
t01 := map[string]int64{
"x": 1,
}
fmt.Println(t01)
t02 := map[string][]int64{
"x": {1, 2, 3, 4, 5, 6, 7, 8, 9},
}
fmt.Println(t02)
text := `{"x":[1,2,3,4,5,6,7,8,9]}`
reader := strings.NewReader(text)
parser := json.NewDecoder(reader)
var t1 T1
a1 := parser.Decode(&t1)
fmt.Println(a1, t1)
var t2 map[string][]int
a2 := parser.Decode(&t2)
fmt.Println(a2, t2)
df := ReadCSV(reader)
fmt.Println(df)
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。