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.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_table_dataframe_to_string(stream_table, **kwargs)[source]

Method to print a stream table from a dataframe. Method takes any argument understood by DataFrame.to_string