cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
Choose Language Hide Translation Bar
lala
Level VIII

How to install dt2pandas library in JMP18 python on windows OS?

Thanks!

import jmp
from dt2pandas import dt2df
  • I was looking at the MAC code

2024-11-23_13-44-54.png

7 REPLIES 7
lala
Level VIII

Re: How to install dt2pandas library in JMP18 python on windows OS?

Traceback (most recent call last):
  File "<string>", line 2, in <module>
ModuleNotFoundError: No module named 'dt2pandas'
jthi
Super User

Re: How to install dt2pandas library in JMP18 python on windows OS?

You can make a copy of dt2pandas.py to same folder where your .jsl file is OR most likely better option, copy it to JMP's site-packages ( Scripting Guide > Python > Creating a Pandas DataFrame from a JMP Data Table).

jthi_0-1732371593260.png

 

-Jarmo
lala
Level VIII

Re: How to install dt2pandas library in JMP18 python on windows OS?

I don't know how to operate, I have copied it into two directories
My script is put in C:\test2.py

 

Thanks!

2024-11-24_07-38-25.png

jthi
Super User

Re: How to install dt2pandas library in JMP18 python on windows OS?

jthi_1-1732430589873.png

The path full path (on windows) is something like this

C:\Users\<user>AppData\Roaming\JMP\JMP\Python\Python311\site-packages (you should be able to access it with %appdata%\JMP\JMP\Python\Python311\site-packages)

-Jarmo
lala
Level VIII

Re: How to install dt2pandas library in JMP18 python on windows OS?

Neither was successful.

dt = New Table( "Array - JSL", Add Rows( 10 ),New Column( "A"), New Column("AB"));
ABC = [1.61803, 3.14159, 5., 7., 9., 2.1, 0.8, 0.5321, 0.443682, 0.00012];
Column( dt, "A" ) <<Set Values(ABC );
Column( dt, "AB" ) << Set Values( Reverse(ABC));
Python Send(dt);
Python Submit ("\[
import jmp
from dt2pandas import dt2df
DA = dt2df(dt)
DA['SUM'] = DA['A'] + DA['AB']
]\");
dt2 = Python Get(DA);
dt2 << New Data View;

2024-11-24_15-28-52.png

jthi
Super User

Re: How to install dt2pandas library in JMP18 python on windows OS?

Have you checked out what you are trying to import? For me that error message is saying that dt2pandas does not have dt2df. Personally, I wouldn't use that method described in dt2pandas.py (at least the version I have) as it messes with your JMP Preferences and that is very rarely a good idea. It is quite easy to write your own function to do this (I assume you are trying to convert JMP datatable to pandas dataframe) and there are quite a few examples in JMP community.

-Jarmo

Re: How to install dt2pandas library in JMP18 python on windows OS?

The dt2pandas.py file contained within $SAMPLE_SCRIPTS/Python does not have a dt2df() function.  The sample scripts contains a to_pandas() function.  This sample is an example of exactly how JMP 14 through JMP 17 created a pandas dataframe from a JMP data table via a CSV file in the filesystem.  The other option not mentioned is just copy the function into your own file instead of importing it.  Though either copying to your JMP site-packages directory or the same directory as your script.