Closed pradithya closed 2 years ago
Hello @pradithya,
I believe following code will solve your question...
package main
import (
"fmt"
"github.com/go-gota/gota/dataframe"
)
func main() {
rec1 := [][]string{
{"Col1", "Col2"},
{"11", "21"},
{"12", "22"},
}
rec2 := [][]string{
{"Col3", "Col4"},
{"31", "41"},
{"32", "42"},
}
df1 := dataframe.LoadRecords(rec1)
df2 := dataframe.LoadRecords(rec2)
fmt.Println(df1)
fmt.Println(df2)
dd := df1.CBind(df2)
fmt.Println(dd)
}
Result:
[2x2] DataFrame
Col1 Col2
0: 11 21
1: 12 22
<int> <int>
[2x2] DataFrame
Col3 Col4
0: 31 41
1: 32 42
<int> <int>
[2x4] DataFrame
Col1 Col2 Col3 Col4
0: 11 21 31 41
1: 12 22 32 42
<int> <int> <int> <int>
Is there a way to concatenate dataframe into another column-wise?
e.g.
Result: