Closed andrewm4894 closed 3 years ago
Your CSV string is not valid. In order to make it look nice, you've added tabs/spaces at the start of each line
Format it to look like the one in example or read from a CSV file
imports "github.com/rocketlaunchr/dataframe-go/imports"
Import path is not correct
Thank you - working code below:
package main
import (
"context"
"fmt"
"strings"
imports "github.com/rocketlaunchr/dataframe-go/imports"
)
func main() {
csvStr := `
colA,colB
1,"First"
2,"Second"
3,"Third"
4,"Fourth"`
ctx := context.Background()
df, err := imports.LoadFromCSV(ctx, strings.NewReader(csvStr), imports.CSVLoadOptions{
DictateDataType: map[string]interface{}{
"colA": int64(0),
"colB": "",
},
})
fmt.Println(err)
fmt.Println(df)
}
When i run the below example to read in a df from a dummy string i get the below errors:
I'm not really sure what i'm doing wrong here. Was trying to use example from this sort of approach: https://github.com/rocketlaunchr/dataframe-go/blob/master/imports/infer_test.go
Here is the output of go env
p.s. i'm new to Go so pretty sure it could be me doing something silly :)