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 :)
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.
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.
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.
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
Lots of choices. Perhaps something like this to post-process the string.
regex("a,b,c,,,,,,,", ",*$", "", GLOBALREPLACE)
/*:
"a,b,c"
Here's some character manipulation info:
http://www.jmp.com/support/help/Work_with_Character_Functions.shtml
https://community.jmp.com/t5/Uncharted/JSL-Character-String-Functions/ba-p/21323
https://community.jmp.com/t5/Uncharted/Regex/ba-p/21008
https://community.jmp.com/t5/Uncharted/Pattern-Matching/ba-p/21005
https://community.jmp.com/t5/Uncharted/Back-Reference/ba-p/21267
That is great! Thank you Craige for great support!
@Paul_Nelson, building on GM1's latest post:
running this script:
Clear Log();
Names Default To Here( 1 );
Python Init(Path("/Library/Frameworks/Python.framework/Versions/3.7/lib/libpython3.7.dylib"),
Use Python Version("3.7")
);
Python Submit("\[
print("Done importing modules")
]\");
Python Term();
gives the following output in the log:
Running this JSL script:
Clear Log();
Names Default To Here( 1 );
Python Init(Path("/Library/Frameworks/Python.framework/Versions/3.7/lib/libpython3.7.dylib"),
Use Python Version("3.7")
);
Python Submit("\[
import numpy as np
print("Done importing modules")
]\");
Python Term();
gives the following output to the log:
GIven the succesfull exit code, I think this error is very unclear. JMP/JSL seems to not know where to find modules to import?? Any help is greatly appreciated