go-gota / gota

Gota: DataFrames and data wrangling in Go (Golang)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Question: reorder columns in a dataframe.

wenmengliu opened this issue · comments

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!

Hi,

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