// df := dataframe.ReadCSV(/*your io variable*/)
// I use this example
df := dataframe.LoadRecords(
[][]string{
[]string{"A", "B", "C", "D"},
[]string{"a", "4", "5.1", "true"},
[]string{"k", "5", "7.0", "true"},
[]string{"k", "4", "6.0", "true"},
[]string{"a", "2", "7.1", "false"},
},
)
fmt.Println("Original dataframe:")
fmt.Println(df)
// only select A, B, C
// and update df
df = df.Select([]int{0, 1, 2}) // []string{"A", "B", "C",}
fmt.Println("Updated dataframe:")
fmt.Println(df)
注意:如果可以的话,不要使用这个包,因为这个包不支持! Github repo是这样说的:This is an implementation of DataFrames, Series and data wrangling methods for the Go programming language. The API is still in flux so use at your own risk. 更好的方法是在python中使用pandas!
1条答案
按热度按时间dnph8jn41#
您可以使用select:
注意:如果可以的话,不要使用这个包,因为这个包不支持!
Github repo是这样说的:
This is an implementation of DataFrames, Series and data wrangling methods for the Go programming language. The API is still in flux so use at your own risk.
更好的方法是在python中使用pandas!