transform a single column in multiple rows

This is the place for queries that don't fit in any of the other categories.

transform a single column in multiple rows

Postby pochis40 » Fri Nov 01, 2013 6:01 am

I have a column (1 number for each row), and I would like to turn it into this:
from this:
1
2
3
4
7
8
33
55
77
88
99
in so
1 2 3 4 7
8 33 55 77 88 99

how could I do?
Thanks
Last edited by Yoriz on Fri Nov 01, 2013 6:25 am, edited 1 time in total.
Reason: First post lock
pochis40
 
Posts: 2
Joined: Fri Nov 01, 2013 5:51 am

Re: transform a single column in multiple rows

Postby Yoriz » Fri Nov 01, 2013 6:32 am

Hi, Welcome to the forum.
Please read the 'new user read this' link in my signature.

What is the current data structure of your data ?.
What would you like the output data structure to be ?.
What decides that the cutoff point for the end of row one be the number 7 and/or contains 5 characters ?.
Do you have any code that you have attempted so far ?.
New Users, Read This
Join the #python-forum IRC channel on irc.freenode.net!
Image
User avatar
Yoriz
 
Posts: 1161
Joined: Fri Feb 08, 2013 1:35 am
Location: UK

Re: transform a single column in multiple rows

Postby pochis40 » Sat Nov 02, 2013 6:40 am

INPUT FILE
Code: Select all
938.74997
936.47397
924.44197
912.87498
895.67598
886.89998
873.52498
863.03997
843.89798
826.83897
811.63994
797.92192
786.41891
771.09691
763.19992
754.0589
748.89689
744.42189
749.42486
755.35587
763.64889
777.92191
798.31491
824.13991
841.50792
854.16393
863.93593
878.18192
887.49193
887.50194
883.82694
884.96694
884.74694
883.38493
886.67493
892.97793
903.20994
906.30596
910.06097
922.53397
934.68597
941.21797
952.82198
962.01099
967.84299
967.933
966.962
966.202
963.869
956.667
953.98

etc...

OUTPUT FILE
Code: Select all
938.74997   936.47397   924.44197   912.87498   895.67598   886.89998   873.52498   863.03997   843.89798   826.83897   811.63994
936.47397   924.44197   912.87498   895.67598   886.89998   873.52498   863.03997   843.89798   826.83897   811.63994   797.92192
924.44197   912.87498   895.67598   886.89998   873.52498   863.03997   843.89798   826.83897   811.63994   797.92192   786.41891
912.87498   895.67598   886.89998   873.52498   863.03997   843.89798   826.83897   811.63994   797.92192   786.41891   771.09691
895.67598   886.89998   873.52498   863.03997   843.89798   826.83897   811.63994   797.92192   786.41891   771.09691   763.19992
886.89998   873.52498   863.03997   843.89798   826.83897   811.63994   797.92192   786.41891   771.09691   763.19992   754.0589
873.52498   863.03997   843.89798   826.83897   811.63994   797.92192   786.41891   771.09691   763.19992   754.0589   748.89689
863.03997   843.89798   826.83897   811.63994   797.92192   786.41891   771.09691   763.19992   754.0589   748.89689   744.42189
843.89798   826.83897   811.63994   797.92192   786.41891   771.09691   763.19992   754.0589   748.89689   744.42189   749.42486
826.83897   811.63994   797.92192   786.41891   771.09691   763.19992   754.0589   748.89689   744.42189   749.42486   755.35587
811.63994   797.92192   786.41891   771.09691   763.19992   754.0589   748.89689   744.42189   749.42486   755.35587   763.64889
797.92192   786.41891   771.09691   763.19992   754.0589   748.89689   744.42189   749.42486   755.35587   763.64889   777.92191
786.41891   771.09691   763.19992   754.0589   748.89689   744.42189   749.42486   755.35587   763.64889   777.92191   798.31491
771.09691   763.19992   754.0589   748.89689   744.42189   749.42486   755.35587   763.64889   777.92191   798.31491   824.13991
763.19992   754.0589   748.89689   744.42189   749.42486   755.35587   763.64889   777.92191   798.31491   824.13991   841.50792
754.0589   748.89689   744.42189   749.42486   755.35587   763.64889   777.92191   798.31491   824.13991   841.50792   854.16393
748.89689   744.42189   749.42486   755.35587   763.64889   777.92191   798.31491   824.13991   841.50792   854.16393   863.93593
744.42189   749.42486   755.35587   763.64889   777.92191   798.31491   824.13991   841.50792   854.16393   863.93593   878.18192
749.42486   755.35587   763.64889   777.92191   798.31491   824.13991   841.50792   854.16393   863.93593   878.18192   887.49193
755.35587   763.64889   777.92191   798.31491   824.13991   841.50792   854.16393   863.93593   878.18192   887.49193   887.50194
763.64889   777.92191   798.31491   824.13991   841.50792   854.16393   863.93593   878.18192   887.49193   887.50194   883.82694
777.92191   798.31491   824.13991   841.50792   854.16393   863.93593   878.18192   887.49193   887.50194   883.82694   884.96694
798.31491   824.13991   841.50792   854.16393   863.93593   878.18192   887.49193   887.50194   883.82694   884.96694   884.74694
824.13991   841.50792   854.16393   863.93593   878.18192   887.49193   887.50194   883.82694   884.96694   884.74694   883.38493
841.50792   854.16393   863.93593   878.18192   887.49193   887.50194   883.82694   884.96694   884.74694   883.38493   886.67493
854.16393   863.93593   878.18192   887.49193   887.50194   883.82694   884.96694   884.74694   883.38493   886.67493   892.97793
863.93593   878.18192   887.49193   887.50194   883.82694   884.96694   884.74694   883.38493   886.67493   892.97793   903.20994
878.18192   887.49193   887.50194   883.82694   884.96694   884.74694   883.38493   886.67493   892.97793   903.20994   906.30596
887.49193   887.50194   883.82694   884.96694   884.74694   883.38493   886.67493   892.97793   903.20994   906.30596   910.06097
887.50194   883.82694   884.96694   884.74694   883.38493   886.67493   892.97793   903.20994   906.30596   910.06097   922.53397
883.82694   884.96694   884.74694   883.38493   886.67493   892.97793   903.20994   906.30596   910.06097   922.53397   934.68597
884.96694   884.74694   883.38493   886.67493   892.97793   903.20994   906.30596   910.06097   922.53397   934.68597   941.21797
884.74694   883.38493   886.67493   892.97793   903.20994   906.30596   910.06097   922.53397   934.68597   941.21797   952.82198
883.38493   886.67493   892.97793   903.20994   906.30596   910.06097   922.53397   934.68597   941.21797   952.82198   962.01099
886.67493   892.97793   903.20994   906.30596   910.06097   922.53397   934.68597   941.21797   952.82198   962.01099   967.84299
892.97793   903.20994   906.30596   910.06097   922.53397   934.68597   941.21797   952.82198   962.01099   967.84299   967.933
903.20994   906.30596   910.06097   922.53397   934.68597   941.21797   952.82198   962.01099   967.84299   967.933   966.962
906.30596   910.06097   922.53397   934.68597   941.21797   952.82198   962.01099   967.84299   967.933   966.962   966.202
910.06097   922.53397   934.68597   941.21797   952.82198   962.01099   967.84299   967.933   966.962   966.202   963.869
922.53397   934.68597   941.21797   952.82198   962.01099   967.84299   967.933   966.962   966.202   963.869   956.667
934.68597   941.21797   952.82198   962.01099   967.84299   967.933   966.962   966.202   963.869   956.667   953.98
941.21797   952.82198   962.01099   967.84299   967.933   966.962   966.202   963.869   956.667   953.98   947.185
952.82198   962.01099   967.84299   967.933   966.962   966.202   963.869   956.667   953.98   947.185   940.074
962.01099   967.84299   967.933   966.962   966.202   963.869   956.667   953.98   947.185   940.074   933.73
967.84299   967.933   966.962   966.202   963.869   956.667   953.98   947.185   940.074   933.73   916.053
967.933   966.962   966.202   963.869   956.667   953.98   947.185   940.074   933.73   916.053   905.632
966.962   966.202   963.869   956.667   953.98   947.185   940.074   933.73   916.053   905.632   896.086
966.202   963.869   956.667   953.98   947.185   940.074   933.73   916.053   905.632   896.086   889.996
963.869   956.667   953.98   947.185   940.074   933.73   916.053   905.632   896.086   889.996   884.523
956.667   953.98   947.185   940.074   933.73   916.053   905.632   896.086   889.996   884.523   879.027
953.98   947.185   940.074   933.73   916.053   905.632   896.086   889.996   884.523   879.027   866.604
Last edited by Mekire on Sat Nov 02, 2013 7:12 am, edited 1 time in total.
Reason: Lock.
pochis40
 
Posts: 2
Joined: Fri Nov 01, 2013 5:51 am

Re: transform a single column in multiple rows

Postby Mekire » Sat Nov 02, 2013 7:14 am

As Yoriz asked:
Yoriz wrote:What decides that the cutoff point for the end of row one be the number 7 and/or contains 5 characters ?.
Do you have any code that you have attempted so far ?.


Show us some attempts you have made if you would like assistance.

-Mek
User avatar
Mekire
 
Posts: 1123
Joined: Thu Feb 07, 2013 11:33 pm
Location: Asakusa, Japan


Return to General Coding Help

Who is online

Users browsing this forum: Google [Bot] and 2 guests