Minitab Statistical Software integrates with Python, a general-purpose programming language with applications in data science. To accomplish Python integration, Minitab, LLC provides the mtbpy module. With this custom module, you can create tables, graphs, messages, and notes in Python and display them in Minitab. Python integration offers the flexibility of custom Python code within Minitab's easy-to-use interface, and the results can be saved, stored, and shared in Minitab Project Files. After you install the mtbpy package, you're ready to run Python code from Minitab. If you have Python code that you want to access routinely, you can customize Minitab's interface to make the analysis more accessible through custom buttons or menus.
For more information on Minitab's Python module, including Python code examples, go to Python API Reference.
For more information on Python, consult the guidance available at www.python.org.
All the files referenced in this guide are available in this .ZIP file: python_guide_files.zip.
Install and run Python before you attempt to integrate Python with Minitab Statistical Software. For assistance with the installation of Python, please consult with your organization's technical support department. Minitab Technical Support cannot assist with the installation of Python.
On Python's website, click . On the page, Python Releases for Windows, scroll to the version of Python that you want to install. Download and run the version linked as either "Windows x86-64 executable installer" or "Windows x86-64 web-based installer".
If you are using Python through an Anaconda environment, go to Additional instructions for Anaconda environments.
If you have already installed Python and
running python
in the Microsoft® Windows Command Prompt opens the Microsoft®
Store, go to Frequently Asked Questions about using Python on
Windows.
python -m pip install mtbpy
If you have already installed Python and running python
in the
Microsoft® Windows Command Prompt opens the
Microsoft® Store, go to Frequently Asked Questions about using Python on Windows.
After Python and the mtbpy package are installed, you can use the PYSC command to run Python from Minitab.
Use the following steps to verify that Minitab can find Python and mtbpy.
File | Description |
---|---|
test.py | A sample Python script used throughout this guide. For this section, you run the script without arguments. When the script runs successfully, the result is the message "Minitab successfully located your Python installation." |
PYSC "test.py"
If the Minitab Command Line is not visible, choose .
Typically, Python integration with Minitab works best when the files that you use are in the default folder location for Minitab files. If you do not specify a file path when you run Python from within Minitab, Minitab looks for your Python files in the default folder.
The default location is the "My Documents" folder.
In the Microsoft® Windows operating system, if your Python file is in the default folder and you receive the error "File not found:", check the default file location in your Minitab settings. To view or change the default file location in Minitab, choose .