cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar

issues running jmp2pandas.py

I am getting a termination error every time I run jmp2pandas. The table is formed, but then the termination error appears (see attached image).

import jmp2pandas
import pandas as pd

data = {
    "Name": ["Alice", "Bob", "Charlie"],
    "Age": [25, 30, 35],
    "City": ["New York", "London", "Paris"]
}

df = pd.DataFrame(data)

jmp2pandas.df2dt(df,dt_title='Example df to dt')
1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: issues running jmp2pandas.py

I would suggest using more modern methods to go from dataframe to datatable as you have JMP19 (jmp.from_dataframe)

 

View more...
import jmp

import jmputils

try:
    # pandas depends on numpy will install numpy if needed
    if not jmputils.is_installed('pandas'):
        jmputils.jpip('install', 'pandas', echo=False)
except Exception as e:
    print(f'Install failed with exception: {e}')

import pandas as pd
import numpy as np

pandas_df = pd.DataFrame(
    {
        "A": 1.0,
        "B": pd.Timestamp("20130102"),
        "C": pd.Series(1, index=list(range(4)), dtype="float32"),
        "D": np.array([3] * 4, dtype="int32"),
        "E": pd.Categorical(["test", "train", "test", "train"]),
        "F": "foo",
    }
)
print(pandas_df)

dt = jmp.from_dataframe(pandas_df)
print(dt)

See Scripting Index

jthi_1-1779198245915.png

 

 

 

Going further with Python in JMP 19

 

-Jarmo

View solution in original post

6 REPLIES 6
hogi
Level XIII

Re: issues running jmp2pandas.py

AI in the loop?

Re: issues running jmp2pandas.py

Are you asking if AI is being used? or if AI is causing the error?

jthi
Super User

Re: issues running jmp2pandas.py

Which JMP version are you using?

-Jarmo

Re: issues running jmp2pandas.py

JMP 19.0.0

jthi
Super User

Re: issues running jmp2pandas.py

I would suggest using more modern methods to go from dataframe to datatable as you have JMP19 (jmp.from_dataframe)

 

View more...
import jmp

import jmputils

try:
    # pandas depends on numpy will install numpy if needed
    if not jmputils.is_installed('pandas'):
        jmputils.jpip('install', 'pandas', echo=False)
except Exception as e:
    print(f'Install failed with exception: {e}')

import pandas as pd
import numpy as np

pandas_df = pd.DataFrame(
    {
        "A": 1.0,
        "B": pd.Timestamp("20130102"),
        "C": pd.Series(1, index=list(range(4)), dtype="float32"),
        "D": np.array([3] * 4, dtype="int32"),
        "E": pd.Categorical(["test", "train", "test", "train"]),
        "F": "foo",
    }
)
print(pandas_df)

dt = jmp.from_dataframe(pandas_df)
print(dt)

See Scripting Index

jthi_1-1779198245915.png

 

 

 

Going further with Python in JMP 19

 

-Jarmo

Re: issues running jmp2pandas.py

Agreed! 

I guess @mhw_novonesis was using this reference: Creating a Pandas DataFrame from a JMP Data Table, but now there is the new function (as of JMP 19): jmp.from_dataframe()

Recommended Articles