diff --git a/dataframe_test.go b/dataframe_test.go index 51a051c51d6337a99c6c998d3b1750fb9a3c6060..a739b6cb3f459f9dab81c762233d8a402411975a 100644 --- a/dataframe_test.go +++ b/dataframe_test.go @@ -36,7 +36,7 @@ func TestLoadStructs(t *testing.T) { } func TestDataFrame_Concat(t *testing.T) { - d1 := []float64{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12} + d1 := []float64{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12} s1 := NewNDFrame[float64]("x", d1...) df1 := NewDataFrame(s1) d2 := []float64{101, 102} diff --git a/dataframe_xstring.go b/dataframe_xstring.go index c5084e8903321c75a1db12421c3478354b50b05b..78fbd087e0289b060a001fd260e0d8d2daa24cb0 100644 --- a/dataframe_xstring.go +++ b/dataframe_xstring.go @@ -72,14 +72,18 @@ func (self DataFrame) print( } // Add the row numbers + rowNumbersOffset := 0 for i := 0; i < nTotal+1; /*self.nrows+1*/ i++ { add := "" - if i == 0 || (i == nMinRows+1 && shortening) { + if i == 0 { // 跳过 + } else if i == nMinRows+1 && shortening { + // 跳过 + rowNumbersOffset -= 1 } else if i < nMinRows+1 { - add = strconv.Itoa(i-1) + ":" + add = strconv.Itoa(i-1+rowNumbersOffset) + ":" } else { - add = strconv.Itoa(nrows-maxRows+i-1) + ":" + add = strconv.Itoa(nrows-maxRows+i-1+rowNumbersOffset) + ":" } //fmt.Println(i) records[i] = append([]string{add}, records[i]...) diff --git a/go.mod b/go.mod index e82b99d11d591333c8c9395de5e31e387840b991..ea409fabdc4850de0f15ee51236213f172cb3618 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( gitee.com/quant1x/data v0.7.16 github.com/chewxy/math32 v1.10.1 github.com/huandu/go-clone v1.4.1 - github.com/mymmsc/gox v1.3.8 + github.com/mymmsc/gox v1.3.9 github.com/olekukonko/tablewriter v0.0.5 github.com/shirou/gopsutil/v3 v3.23.1 github.com/tealeg/xlsx v1.0.5 @@ -18,7 +18,7 @@ require ( ) require ( - gitee.com/quant1x/gotdx v1.2.3 // indirect + gitee.com/quant1x/gotdx v1.2.5 // indirect github.com/dlclark/regexp2 v1.7.0 // indirect github.com/dop251/goja v0.0.0-20230216180835-5937a312edda // indirect github.com/frankban/quicktest v1.11.2 // indirect diff --git a/go.sum b/go.sum index b955b648eee98b5ef4ad329196b9b81901c3d681..748e256079c48289e3b54de58afec04979fdd4b7 100644 --- a/go.sum +++ b/go.sum @@ -1,7 +1,7 @@ gitee.com/quant1x/data v0.7.16 h1:QYJcg/sAowoumurMDLDl7MsDFVNGc0w+57UCNwZMhrI= gitee.com/quant1x/data v0.7.16/go.mod h1:9xgfw26RyhtjKml+C1tcU2sBWT+PxIXYZ1EJajbAuCA= -gitee.com/quant1x/gotdx v1.2.3 h1:JHKfZL52tfrEnFJ+tzATUaAEIsHQNjywM6zWCpbdtsg= -gitee.com/quant1x/gotdx v1.2.3/go.mod h1:+1sjU0yMgkW1JGcbYjPIaNwR7CmE0oS+1ZaIePp0LQA= +gitee.com/quant1x/gotdx v1.2.5 h1:zPbAPyLRg0uRv9bLziEV5EPoO5PBwffbkKQzI1yuDgA= +gitee.com/quant1x/gotdx v1.2.5/go.mod h1:lOJYzC4mcKmeHpm1L5jl94S0pPifue1sf9JMTP2kmho= github.com/chewxy/math32 v1.10.1 h1:LFpeY0SLJXeaiej/eIp2L40VYfscTvKh/FSEZ68uMkU= github.com/chewxy/math32 v1.10.1/go.mod h1:dOB2rcuFrCn6UHrze36WSLVPKtzPMRAQvBvUwkSsLqs= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= @@ -45,8 +45,8 @@ github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2 github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWVwUuU= github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= -github.com/mymmsc/gox v1.3.8 h1:OEom0fY5SlPGf4GAX9T83L2cBx1bQCx1pD6R6NtQTKs= -github.com/mymmsc/gox v1.3.8/go.mod h1:KAD7bkNM7N24gNCuR7YsmKe1cJLZ5o5x885uctG5mw0= +github.com/mymmsc/gox v1.3.9 h1:8o06xvA8lEGj0PGdLri1qE94gODiCSnoNoezgKx1qFM= +github.com/mymmsc/gox v1.3.9/go.mod h1:KAD7bkNM7N24gNCuR7YsmKe1cJLZ5o5x885uctG5mw0= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY=