go-gota / gota

Gota: DataFrames and data wrangling in Go (Golang)
Other
2.98k stars 276 forks source link

Question: reorder columns in a dataframe. #159

Open wenmengliu opened 2 years ago

wenmengliu commented 2 years ago
Is there a way to reorder columns of a dataframe? eg/ df: col1 col2 col3
11 21 10
12 22 40
we want to order df in [col2, col1, col3] as follow: col2 col1 col3
21 11 10
22 12 40

Thank you!

chrmang commented 2 years ago

Hi,

you can select columns by index or by name: DataFrame.Select (see example). Just select all columns in your needed order.