语境:
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.
我正在尝试的示例:
// 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;
观察到的问题:
-
dt_merged is created but contains no data. [但数据框已生成,因为我可以将其保存为 csv 并使用它]
-
Using global in Python does not seem to fix the issue.
-
Python Get() does not appear to recognize the pandas DataFrame correctly.
我想要的是:
我正在考虑的潜在解决方案:
环境:
-
JMP 18
-
Python 3.x(嵌入式)
- 在 JSL 脚本中使用
非常感谢任何将 pandas DataFrames 从 Python 发送回 JMP 的指导或工作示例!