On 05/29/2017 07:23 AM, Vikram Rawat wrote:> Can anybody please tell me
io.Writer is an interface that matches any concrete type that implements
the Write() method:
https://golang.org/pkg/io/#Writer
os.Create returns a writer that you can use to write to a file like:
w, err := os.Create("myfile.csv")
and you can write your CSV to it using the WriteCSV() method described
below:
https://godoc.org/github.com/kniren/gota/dataframe
So based on the documentation, something like the code below should work:
df := dataframe.LoadRecords(
[][]string{
[]string{"A", "B", "C", "D"},
[]string{"a", "4", "5.1", "true"},
[]string{"b", "4", "6.0", "true"},
[]string{"c", "3", "6.0", "false"},
[]string{"a", "2", "7.1", "false"},
},
)
w, err := os.Create("myfile.csv")
if err == nil {
/* handle os.Create() error here. */
}
df.WriteCSV(w)
...