Vikram,

On Mon, May 29, 2017 at 1:23 PM, Vikram Rawat <[email protected]>
wrote:

> Can anybody please tell me how to write GOTA Golang dataframes on a csv...
>
> It's been 2 days I am trying to find a way to write dataframes onto a csv.
> can anybody please help me understand what does this IO.writer means and
> how to use it...
>

I am not an expert wrt gota/dataframe but here is what I got:

$> go run ./main.go
$> cat out.csv
COL.1,COL.2,COL.3
b,1,3.000000
a,2,4.000000

with the following main.go file:
package main

import (
"log"
"os"

"github.com/kniren/gota/dataframe"
"github.com/kniren/gota/series"
)

func main() {
df := dataframe.New(
series.New([]string{"b", "a"}, series.String, "COL.1"),
series.New([]int{1, 2}, series.Int, "COL.2"),
series.New([]float64{3.0, 4.0}, series.Float, "COL.3"),
)

o, err := os.Create("out.csv")
if err != nil {
log.Fatal(err)
}
defer o.Close()

err = df.WriteCSV(o)
if err != nil {
log.Fatal(err)
}

err = o.Close()
if err != nil {
log.Fatal(err)
}
}

here is the doc+examples for gota/dataframe:
 https://godoc.org/github.com/kniren/gota/dataframe#pkg-examples

hth,
-s

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to