I often use AI to write Python code, but I find it's less familiar with JSL. I explain that I want to open local JMP files or save results as JMP tables, but it often gives me code that deals with CSV files, or the JMP table code it generates doesn't work.
I have to constantly remind it of the correct syntax.
Here's a syntax reference for reading JMP files:
import jmp
import numpy as np
import pandas as pd
from pandas.api.types import is_object_dtype, is_numeric_dtype, is_bool_dtype, is_string_dtype
# creating a Pandas dataframe from a JMP DataTable directly
dt = jmp.open(jmp.SAMPLE_DATA + "Big Class.jmp")
# create pandas DataFrame from Big Class
df = pd.DataFrame()
for idx in range( len(dt) ):
df[ dt[idx].name ] = np.array( dt[idx] )
Here's a syntax reference for saving as JMP tables:
import jmp
dt = jmp.DataTable("JMP", df.shape[0])
for col in df.columns:
col_type = jmp.DataType.Numeric
dt.new_column(col, col_type)
dt[col] = list(df[col])