\(\renewcommand\AA{\unicode{x212B}}\)
Table of Contents
Name | Direction | Type | Default | Description |
---|---|---|---|---|
OutputWorkspace | Output | TableWorkspace | Mandatory | The name of the table workspace that will be created. |
Creates an empty table workspace, which you can then populate with items of various types.
For a complete list of TableWorkspace methods accessible from Python please see the ITableWorkspace.
Example - Creating and Populating a Table
my_table = CreateEmptyTableWorkspace()
my_table.setTitle("My Data List")
my_table.addColumn("str", "Instrument Name")
my_table.addColumn("int", "Run Number")
my_table.addRow(["MUSR", 10245])
my_table.addRow(["IRIS", 8465])
my_table.addRow(["SANS2D", 20462])
print("The run number for IRIS is {}.".format(my_table.cell("Run Number", 1)))
print("The number of rows is {}.".format(my_table.rowCount()))
print("The title of the table is {}.".format(my_table.getTitle()))
print("Remember, the table is a workspace. It's name is \"{}\".".format(my_table.name()))
Output:
The run number for IRIS is 8465.
The number of rows is 3.
The title of the table is My Data List.
Remember, the table is a workspace. It's name is "my_table".
Categories: AlgorithmIndex | Utility\Workspaces
Python: CreateEmptyTableWorkspace.py