The Python interfaces are also scriptable using a Python connection object. A scriptable Python connection object can be obtained using the Python Connect() function. See “Python Connect()”.
Description
Example
Names Default To Here( 1 );
Python Create JPIP CMD();
Description
Submits Python code to the Python environment given a list of inputs. On completion, returns a list of outputs.
Returns
Returns 0 if successful and 1 otherwise. The results are returned using the list of outputs. Given each element of the JMP output list, the corresponding Python variable value is returned.
Positional Arguments
{list of inputs}
A list of JMP variable names to be sent to Python as inputs.
{list of outputs}
A list of JMP variable names to be retrieved from Python as outputs.
Python code
The quoted Python code to submit.
Description
Returns
Returns the value of the named variable.
Argument
name
The name of the JMP variable to be received from Python. The argument can represent any of the following Python data types: numeric, quoted string, matrix, list, or data frame.
Description
This function is deprecated. It returned the last graphics object written by matplotlib’s pyplot in a graphics format specified by the format argument.
Example
The following example shows the previous method commented out and the new alternative.
Names Default To Here( 1 );
ml = Python Submit(
"\[
# This sample requires the matplotlib package to be installed.
import matplotlib.pyplot as plt
plt.clf() # make sure we are starting with a clean plot
plt.plot([1, 2, 3, 4])
plt.ylabel('some numbers')
plt.draw()
# Save image to location of your choosing
plt.savefig('/tmp/get_graphics_img.png')
]\"
);
// plot = Python Get Graphics( png ); // DEPRECATED
plot = Open( "/tmp/get_graphics_img.png", png );
pngJMP = New Window( "Plot", Picture Box( plot ) );
Python Submit( "plt.close()" );
rc = Delete File( "/tmp/get_graphics_img.png" );
Description
Gets the current version of the Python installation.
Returns
Returns a list of length 5 that contains the five components of the version number: major, minor, micro, releaselevel, and serial. The releaselevel value is a quoted string.
Description
This wrappers the install of Python packages into the JMP site-packages directory. For operations beyond simple package installation, use Python Create JPIP CMD() to create a command line wrapper script in a directory chosen with Directory Pick(). Alternatively, to run the install from a JMP Python script window, see “Install Python Packages in JMP’s Python Environment” in the JMP Scripting Guide.
Example
Names Default To Here( 1 );
// Install numpy and pandas packages
conn = Python Connect();
conn << Install Packages( "numpy pandas" );
Description
Returns
Always returns 1.
Description
Argument
name
The name of the JMP variable to be sent to Python. Some variable names allowed by JMP are not allowed by Python. When you send using these variables from JMP to Python (the Send message), their names get changed. Use JMP Name to Python Name to determine what the variable name was changed to.
Description
Sends a named variable from JMP to Python.
Returns
Returns 0 if successful and non-zero otherwise.
Argument
name
The name of the JMP variable to be sent to Python.
<Python Name( name )>
Specifies the name assigned to the variable in the Python environment.
Description
Argument
name
The name of the data table to be sent to Python.
<Python Name( name )>
Specifies the name assigned to the data table in the Python environment.
Example
Names Default To Here( 1 );
PythonConnection = Python Connect();
PythonConnection << Send File( "$SAMPLE_DATA/Big Class.jmp" );
dtname = "$SAMPLE_DATA/Baseball.jmp";
PythonConnection << Send File( dtname );
PythonConnection << Submit( "print(Big_Class)" );
PythonConnection << Submit( "print(Baseball)" );
//:*/
print(Big_Class)
/*:
Big Class (5 columns x 40 rows)
//:*/
print(Baseball)
/*:
Baseball (2 columns x 43 rows)
0
Description
Argument
name
A string specifying the name of the object set as a Python variable.
Example
Names Default To Here( 1 );
PythonConnection = Python Connect();
x = [1, 2, 3];
PythonConnection << Set( x );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
PythonConnection << Set( dt );
PythonConnection << Submit( "print(x)" );
PythonConnection << Submit( "print(dt)" );
//:*/
print(x)
/*:
[[1.]
[2.]
[3.]]
//:*/
print(dt)
/*:
Big Class (5 columns x 40 rows)
0
Description
Submits Python code to the Python environment.
Returns
Returns 0 if successful and 1 otherwise.
Required Arguments
Python_code
The quoted Python code to submit.
Description
Submits statements to Python using the quoted path name.
Argument
path
The quoted path to the file that contains the Python source lines to be executed.