cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
Sburel
Level IV

Retrieving data formatted as a string from Python

Hello,

 

I have a simple script that sends a variable to Python to run an SQL query ( going through JMP directly somehow is very slow, python is fine).

 

Anyway, the query runs fine but I can't figure out how to make use of the data generated by Python and format it into a JMP table.

 

Any suggestions would be greatly appreciated.

 

I've created a move script which generates the string exactly as produced by a working SQL query in Python.

 

Thanks

 

Sebastien

names default to here(1);
clear log();
data="STUDY_ID,STUDYID,SPONSOR_REFERENCE_ID,BASAL_DIET,DOSING_END_DATE,DOSING_START_DATE,EXPERIMENTAL_END_DATE,EXPERIMENTAL_START_DATE,FEEDING_REGIMEN,GLP_FLAG,GLP_TYPE,STUDY_END_DATE,STUDY_START_DATE
3713,5500202,P097-17-01,PMI Crt Primate 5048,,,2018-05-11,2017-11-14,BID (twice per day),Y,OECD,2018-09-26,2017-10-20
3728,8482255,HTTsnp-RS01,,,2022-06-23,,2022-05-26,,N,,,2022-05-25
";
python init();

python send(data);

python submit(
"\[
import pandas as pd	
#I can run a SQL query in JMP but for some reasons , the download is very slow and the table to be retrive fairly lage, whereas using Python is very fast so we are trying that option sincethe query is very simple
#in this mock example 'data'is sent to python from JMP but in a real SQL query the data the data is formated as CSV , see below andretrived using python get
#data = df.to_csv(index=False) #retrieve data in csv format
print(data)
]\"
);

getstr = Python Get( data );	//how to convert a string into a table?

	show( getstr);

	Python Term();
1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: Retrieving data formatted as a string from Python

Is there a reason you are not extracting the data into a Pandas.DataFrame, which can then be directly tranferred into a JMP data table?

 

See Extending JMP, Work with Python in the Scripting Guide.

Jim

View solution in original post

2 REPLIES 2
txnelson
Super User

Re: Retrieving data formatted as a string from Python

Is there a reason you are not extracting the data into a Pandas.DataFrame, which can then be directly tranferred into a JMP data table?

 

See Extending JMP, Work with Python in the Scripting Guide.

Jim
Sburel
Level IV

Re: Retrieving data formatted as a string from Python

Thanks for the suggestion. I'll look into it?