How to write .jmp files with JMP pythonHi, I am using JMP19.1.1
I see examples of how to use JMP or JSL to open files, add jsl scripts for plotting and then run them.
Are there examples to use JMP Python to open csv files and write .jmp files with charts in them? What do people do?
Adrian
Automation and ScriptingBasic Data Analysis and ModelingData AccessRe: How to write .jmp files with JMP pythonSaving can be done with save method of DataTable

To add table scripts you can use either run_jsl or scripts with jmp.Expression

Re: How to write .jmp files with JMP pythonHi,
Thanks for responding. I am talking about not using the jmp libraries. I am talking about using python code that is processing data, that spits out csv files. I want to switch to writing .jmp files. Is there a way to do this? i.e. Pandas dataframe directly to .jmp ?
Thanks
Re: How to write .jmp files with JMP pythonTo my knowledge no. You would need to run the Python inside JMP.
Re: How to write .jmp files with JMP pythonHere is what I try to run:
from pathlib import Path
import jmp
csv_path = Path(r"C:\Work\debug\jmp_debug\CT_Pro_PRO0CV2_pass_fail_05302026.csv")
out_path = Path(r"C:\Work\debug\jmp_debug\CT_Pro_PRO0CV2_pass_fail_05302026.jmp")
print("Opening:", csv_path)
dt = jmp.open(str(csv_path))
print("Saving:", out_path)
dt.save(str(out_path))
print("Done")
I run it this way: & "C:\Program Files\JMP\JMP\19\jmp.exe" -R "C:\Work\debug\jmp_debug\jmp_csv_to_jmp_simple.py" in powershell. The problem is this pops up three windows. Do you know if there is anyway to run JMP in a headless fashion? I.e. Run it and not have a collage of windows pop open ?
Re: How to write .jmp files with JMP pythonThe main reason to go directly to .jmp is these files are 4-10 GB in csv format. So this is painful. Ideally, we could pass a pandas dataframe to the jmp table and write it
Re: How to write .jmp files with JMP pythonThis is really painful. It appears there is no real way to make this run in a headless fashion. This is really surprising. I must me wrong and not have the right documenation. If someone has information on how to run jmp in a headless fashion, this would be really helpful. I.e. I can run this in a script and not get three to four new windows popping open.
Re: How to write .jmp files with JMP pythonIn JMP 19.1.3, and plain vanilla Python 3.13.3 (Non JMP), I got the following improvement. This only pops up the .jmp table being created. So this is close to a solution. I would really still like to know if there is headless information ?
from pathlib import Path
import time
import win32com.client
def jsl_quote(path_or_text) -> str:
text = str(path_or_text)
text = text.replace("\\", "\\\\").replace('"', '\\"')
return f'"{text}"'
csv_path = Path(r"C:\Work\debug\jmp_debug\05302026.csv")
out_path = Path(r"C:\Work\debug\jmp_debug\05302026.jmp")
jmp = win32com.client.Dispatch("JMP.Application")
# Try False first. If nothing works, set True while debugging.
jmp.Visible = False
jsl = f"""
Names Default To Here( 1 );
dt = Open({jsl_quote(csv_path)},Invisible);
dt << Save As( {jsl_quote(out_path)} );
Close( dt, No Save );
"""
print("Running JSL...")
jmp.RunCommand(jsl)
# Give JMP a moment if RunCommand returns before save completes.
time.sleep(2)
print("Saved?", out_path.exists(), out_path)
Re: How to write .jmp files with JMP pythonCSV for large files is painful. My suggestion is to write out the files in parquet format, then import pyarrow in JMP, load the parquet file, it can be converted to a pandas dataframe with almost no time cost, JMP can directly read pandas columns in building a data table and has a jmp.from_dataframe( df ) capability. If you are using pandas 3.0 or greater they have started some deprecation warnings, but those have been take care of in development versions of JMP by directly using the pyarrow PyCapsule interface. CSV also has the issue of not being an exact format. Check your decimal points. Conversion from string to double can have small differences especially since it's from numeric to CSV and then back again.
Re: How to write .jmp files with JMP pythonJMP can read/write sqlite files natively if you want to use something other than csv.
Currently when writing/exporting it's one sqlite file per jmp datatable. sqlite can have multiple tables in one file.
Re: How to write .jmp files with JMP pythonsqlite3 has a max # of column set at 64K. If you're under that limit you're probably good to go, but I would also check size of the resulting db. Might not be that much smaller if your files are primarily text. Numerics should take up much less space than CSV.