Context:
I am using JMP 18 with Python integration to merge multiple datasets. The merge and processing in Python works correctly using pandas, but when I try to send the final pandas DataFrame back to JMP using Python Get(), the resulting JMP Data Table is empty. I want to create a JMP table from my pandas DataFrame in Python and access it in JSL.
Example of What I’m Trying:
</CODE></STRONG></PRE>
<PRE>// Send JMP tables to Python
Python Send(jmp_table1);
Python Send(jmp_table2);
// Python processing
Python Submit("
import pandas as pd
def jmp_to_pandas(jmp_table):
cols = list(jmp_table)
data_dict = {}
for col in cols:
data_dict[col.name] = list(col)
return pd.DataFrame(data_dict)
# Convert JMP tables to pandas DataFrames
df1 = convert_jmp_to_pandas(jmp_table1)
df2 = convert_jmp_to_pandas(jmp_table2)
# Merge tables
merged_df = pd.merge_asof(df2, df1, left_on='Time', right_on='Time', direction='nearest')
");
// Attempt to bring merged DataFrame back to JMP
dt_merged = Python Get(merged_df);
dt_merged << Set Name("Merged_Data");
dt_merged << Show Window;
</PRE>
<PRE><STRONG data-start="638" data-end="669"><CODE class=" language-jsl">
Problem Observed:
-
dt_merged is created but contains no data. [but the data frame is generated as I can save it to csv and use it]
-
Using global in Python does not seem to fix the issue.
-
Python Get() does not appear to recognize the pandas DataFrame correctly.
What I Want:
-
Convert a pandas DataFrame into a JMP table from Python.
-
Access it in JSL with proper name, show the window, and manipulate columns.
-
Avoid creating empty tables and maintain all rows/columns.
Potential Solutions I’m Considering:
Environment:
-
JMP 18
-
Python 3.x (embedded)
- Using inside a JSL script
Any guidance or working examples of sending pandas DataFrames back to JMP from Python would be greatly appreciated!