Für die Integration von Python mit Minitab Statistical Software stellt Minitab, LLC das Modul mtbpy bereit. Die folgenden Beschreibungen der Klassen und Methoden aus dem Modul mtbpy unterstützen Sie beim Verfassen von Python-Code, der in Minitab integriert werden kann.
Informationen zum Installieren des Python-Moduls von Minitab und zum Ausführen von Python aus Minitab finden Sie unter Installieren von Python zur Verwendung mit der Minitab Statistical Software.
Weitere Informationen zu Python finden Sie unter www.python.org.
Im Folgenden finden Sie die Methoden für die Klasse mtb_instance.
get_columnRuft eine Spalte aus einem Minitab-Arbeitsblatt für die Verwendung in Python ab.
list zurück. Die list kann entweder Textwerte oder numerische Werte enthalten.from mtbpy import mtbpy column1 = mtbpy.mtb_instance().get_column("C1") column2 = mtbpy.mtb_instance().get_column("My Column")get_constantRuft eine Konstante aus einem Minitab-Arbeitsblatt für die Verwendung in Python ab.
from mtbpy import mtbpy constant1 = mtbpy.mtb_instance().get_constant("K1") constant2 = mtbpy.mtb_instance().get_constant("My Constant")get_matrixRuft eine Matrix aus einem Minitab-Arbeitsblatt für die Verwendung in Python ab.
list von lists zurück.from mtbpy import mtbpy matrix1 = mtbpy.mtb_instance().get_matrix("M1") matrix2 = mtbpy.mtb_instance().get_matrix("My Matrix")add_messageFügt eine Meldung am Ende des Minitab-Ausgabefensters ein.
Nonefrom mtbpy import mtbpy mtbpy.mtb_instance().add_message("This is a message.")set_noteLegt einen Hinweis oben im Minitab-Ausgabefenster fest.
Nonefrom mtbpy import mtbpy mtbpy.mtb_instance().set_note("The output contains one note.")set_noteLegt den Titel oben im Minitab-Ausgabefenster fest.
Nonefrom mtbpy import mtbpy mtbpy.mtb_instance().set_title("The output contains one title.")add_imageFügt ein Bild am Ende des Minitab-Ausgabefensters ein, wenn Sie über eine unterstützte Bilddatei verfügen.
Nonefrom mtbpy import mtbpy import numpy as np import matplotlib.pyplot as plt N_points = 1000 n_bins = 50 x = np.random.randn(N_points) y = .4 * x + np.random.randn(N_points) + 5 fig, axs = plt.subplots(1, 2, sharey=True, tight_layout=True) axs[0].hist(x, bins=n_bins) axs[1].hist(y, bins=n_bins) fig.savefig("histogram.png") mtbpy.mtb_instance().add_image("histogram.png")add_image_bytesFügt ein Bild am Ende des Minitab-Ausgabefensters ein, wenn Sie über ein Bytes-Objekt verfügen.
Nonefrom mtbpy import mtbpy image_data = b'\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00\t\x00\x00\x00\t\x08\x02\x00\x00\x00o\xf3\x91G\x00\x00\x00\x01sRGB\x00\xae\xce\x1c\xe9\x00\x00\x00\x04gAMA\x00\x00\xb1\x8f\x0b\xfca\x05\x00\x00\x00\tpHYs\x00\x00\x0e\xc3\x00\x00\x0e\xc3\x01\xc7o\xa8d\x00\x00\x00"IDAT\x18Wc\xd8a\xbb\x8b\x81\x01\'I\xba\x04\x01i\x9c\x12\x04\xa4qJ\x10\x90\xc6)\xb1\xc3v\x17\x00\xfc\x0bE\x08o,\xff\xe2\x00\x00\x00\x00IEND\xaeB`\x82' mtbpy.mtb_instance().add_image_bytes(image_data)add_tableFügt eine Tabelle am Ende des Minitab-Ausgabefensters ein.
list von lists zurück.list.""."".Nonefrom mtbpy import mtbpy mytitle = "My table title" myheaders = ["Header for column 1", "Header for column 2"] mycolumns = [[1,1,1],[2,2,2]] myfootnote = "My footnote for the table." mtbpy.mtb_instance().add_table(columns=mycolumns, headers=myheaders, title=mytitle, footnote=myfootnote)datetime-Format als Python. Um das datetime-Format von Minitab in das datetime-Format von Unix zu konvertieren, verwenden Sie den folgenden Code: from datetime import datetime, timedelta def minitab_to_unix_datetime(pOrdinal, pEpoch0=datetime(1899, 12, 30)): return(pEpoch0 + timedelta(days=pOrdinal))