Closed vikram-rawat closed 4 years ago
Can you give me a code sample of what you were trying to achieve?
I am currently trying to learn it so that I can recommend it to be used in an upcoming project. But the examples mentioned on the site are not working... this is what I wrote..
package main
import (
"fmt"
"context"
"github.com/rocketlaunchr/dataframe-go"
)
func main() {
s1 := dataframe.NewSeriesInt64("day", nil, 1, 2, 3, 4, 5, 6, 7, 8)
s2 := dataframe.NewSeriesFloat64("sales", nil, 50.3, 23.4, 56.2, nil, nil, 84.2, 72, 89)
df := dataframe.NewDataFrame(s1, s2)
df.Append(nil, 9, 123.16)
df.Append(nil, map[string]interface{}{
"day": 10,
"sales": nil,
})
df.Remove(0)
df.UpdateRow(0, nil, map[string]interface{}{
"day": 3,
"sales": 45,
})
sks := []dataframe.SortKey{
{Key: "sales", Desc: true},
{Key: "day", Desc: true},
}
df.Sort(ctx, sks)
fmt.Print(df.Table())
}
add ctx := context.Background()
at the top
Example with ctx arguements don't work. and I wanted to know how to directly get the data from SQL to a dataframe and serve it as an API. I read your blog too. but that too had exactly the same examples.
This is a great package. thanks for working so hard.