Table Methods¶
The IDAES toolset contians a number of methods for generating and dislpaying summary tables of data in the form of pandas DataFrames
.
Available Methods¶
-
idaes.core.util.tables.
arcs_to_stream_dict
(blk, descend_into=True)[source]¶ Creates a stream dictionary from the Arcs in a model, using the Arc names as keys. This can be used to automate the creation of the streams dictionary needed for the
create_stream_table_dataframe()
andstream_states_dict()
functions.Parameters: - blk (pyomo.environ._BlockData) – Pyomo model to search for Arcs
- descend_into (bool) – If True, search subblocks for Arcs as well. The default is True.
Returns: Dictionary with Arc names as keys and the Arcs as values.
-
idaes.core.util.tables.
create_stream_table_dataframe
(streams, true_state=False, time_point=0, orient='columns')[source]¶ Method to create a stream table in the form of a pandas dataframe. Method takes a dict with name keys and stream values. Use an OrderedDict to list the streams in a specific order, otherwise the dataframe can be sorted later.
Parameters: - streams – dict with name keys and stream values. Names will be used as display names for stream table, and streams may be Arcs, Ports or StateBlocks.
- true_state – indicated whether the stream table should contain the display variables define in the StateBlock (False, default) or the state variables (True).
- time_point – point in the time domain at which to generate stream table (default = 0)
- orient – orientation of stream table. Accepted values are ‘columns’ (default) where streams are displayed as columns, or ‘index’ where stream are displayed as rows.
Returns: A pandas DataFrame containing the stream table data.
-
idaes.core.util.tables.
generate_table
(blocks, attributes, heading=None)[source]¶ Create a Pandas DataFrame that contains a list of user-defined attributes from a set of Blocks.
Parameters: - blocks (dict) – A dictionary with name keys and BlockData objects for values. Any name can be associated with a block. Use an OrderedDict to show the blocks in a specific order, otherwise the dataframe can be sorted later.
- attributes (list or tuple of strings) – Attributes to report from a Block, can be a Var, Param, or Expression. If an attribute doesn’t exist or doesn’t have a valid value, it will be treated as missing data.
- heading (list or tuple of srings) – A list of strings that will be used as column headings. If None the attribute names will be used.
Returns: A Pandas dataframe containing a data table
Return type: (DataFrame)
-
idaes.core.util.tables.
stream_states_dict
(streams, time_point=0)[source]¶ Method to create a dictionary of state block representing stream states. This takes a dict with stream name keys and stream values.
Parameters: - streams – dict with name keys and stream values. Names will be used as display names for stream table, and streams may be Arcs, Ports or StateBlocks.
- time_point – point in the time domain at which to generate stream table (default = 0)
Returns: A pandas DataFrame containing the stream table data.