Subscribe Bookmark RSS Feed

Re: Transposing very large data table

sgourshe

New Contributor

Joined:

Apr 18, 2017

Hi, 

I have a very large data file, (20+ million rows, 10 columns) that I need to transpose. Unfortunately, jmp is not capable of executing such large file quickly or efficiently. I found that jmp is able to manipulate data in text format much easily. I have tried all options of save/open as .txt but no vail..

 

Can someone help transposing this table either in txt format or data table (list, array etc.)? 

I need the following example table to look like the output below, without using the "transpose" function as it won't work for million+ rows: ''

 

Data table

 col1     col2

  a           l

  s           w

  4           j

  t            sdf

  t

  o

  p

 

Desired output (either as a txt file or a table with only 1 col and 2 rows): 

col1, a,s,4,t,t,o,p

col2,l,w,j,sdf

 

Please and Thank you :) 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Craige_Hales

Staff

Joined:

Mar 21, 2013

Solution

I think you have non-numeric columns so you can't use a matrix, You might make your string value as a concatenation of items in a list, and you can get a list from a character column with the <<getvalues message.

alist = dt:a<<getvalues; show(nitems(alist));
astring = concatItems(alist,","); show(length(astring),left(astring,100));

N Items(alist) = 21000000;
Length(astring) = 207635028;
Left(astring, 100) = "1,4,9,16,25,36,49,64,81,100,121,144,169,196,225,256,289,324,361,400,441,484,529,576,625,676,729,784,";

 

JMP has a limit of 2 billion characters for a string. You might be getting close.

 

Craige
6 REPLIES
Craige_Hales

Staff

Joined:

Mar 21, 2013

Solution

I think you have non-numeric columns so you can't use a matrix, You might make your string value as a concatenation of items in a list, and you can get a list from a character column with the <<getvalues message.

alist = dt:a<<getvalues; show(nitems(alist));
astring = concatItems(alist,","); show(length(astring),left(astring,100));

N Items(alist) = 21000000;
Length(astring) = 207635028;
Left(astring, 100) = "1,4,9,16,25,36,49,64,81,100,121,144,169,196,225,256,289,324,361,400,441,484,529,576,625,676,729,784,";

 

JMP has a limit of 2 billion characters for a string. You might be getting close.

 

Craige
sgourshe

New Contributor

Joined:

Apr 18, 2017

Super thank you for quick reply! Easier than I thought. :)
Anyway, I can assign a particular cell in a table to to be this astring?
such that I have a table that has (taking the original example I used) 1 column and 2 rows looking like the following:
Column1
Row1: a,s,4,t,t,o,p
Row2: l,w,j,sdf
Highlighted
Craige_Hales

Staff

Joined:

Mar 21, 2013

Yes, http://www.jmp.com/support/help/Accessing_Data_Values.shtml#790448 has an example like this:

dt:age[10] = 20; // set the value of age in row 10 to 20

You might want to make a prototype 2-line table with the column names (and data types!) you need and use the "get script" from the red triangle menu. You can then paste that script into your own code.  In the example above, [10] is for row 10; you might use two assignments for [1] and [2].  The 20 is for a numeric column; your column is character if the astring variable is going to be stored in it.

Craige
sgourshe

New Contributor

Joined:

Apr 18, 2017

Very cool thanks. Although useful, I was particularly wanting to get only the string value into the cell. Unfortunately the string includes extra comma seperations for empty cells. 

 

ie. given there are 2 columns, the 1st col has 10 rows and the 2nd col only has data for 5 rows. When I implement the string concate that you mentioned above I get the string value for second col as astring = "a,s,r,w,d,,,,,,"

 

I am particulary interested to get only "a,s,r,w,d", excluding the extra comma seperations. Any directions you can point me to? I'd great appreciate it. 

 

Thank you, 

Shiv 

sgourshe

New Contributor

Joined:

Apr 18, 2017

That is great! Thank you Craige for great support!