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
 move the data
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

ulhong84

11 Posts

Posted - 08/01/2022 :  8:33:08 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin):
Operating System:OriginPro 2002 (9.9.0220)


I have several data set in one column.
I want to rearrange each data in each column as shown below.

A(x)
measurement1
3
6
5
measurement 2
5
8
9
measurement 3
5
6
7

A(x) B(Y) C(Y)
measurement1 measurement 2 measurement 3
3 5 5
6 8 6
5 9 7


How can I make it in python code builder?



Edited by - ulhong84 on 08/01/2022 8:35:54 PM

YimingChen

1618 Posts

Posted - 08/02/2022 :  08:34:21 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Can you try the script below?

import originpro as op
wks = op.find_sheet()
data = wks.to_list(0)
chunk_size = 4
chunked_list = [data[i:i+chunk_size] for i in range(0, len(data), chunk_size)]
wks = op.new_sheet()
wks.from_list2(chunked_list, 0, 0)


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