Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: reorder columns in a dataframe. #159

Open
wenmengliu opened this issue Aug 16, 2021 · 1 comment
Open

Question: reorder columns in a dataframe. #159

wenmengliu opened this issue Aug 16, 2021 · 1 comment
Assignees
Labels

Comments

@wenmengliu
Copy link

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
Copy link
Contributor

chrmang commented Aug 19, 2021

Hi,

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

@chrmang chrmang self-assigned this Aug 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants