The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 Forum for Python
 Sort coloums
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Kositi

Germany
4 Posts

Posted - 08/03/2021 :  05:53:39 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hello,
I need some help sorting my coloumns. With the sort function I am only able to sort something in my coloumn. But I need to sort the different coloumns by their longnames. Is there a command I missed or a nice loop?

Thanks for the help.

YimingChen

1618 Posts

Posted - 08/03/2021 :  09:06:27 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Please try the Python script below:

import originpro as op
import pandas as pd

wks = op.find_sheet()
df = wks.to_df()
rslt_df = df.sort_index(axis = 1)
wks = op.new_sheet()
wks.from_df(rslt_df)


James
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000