tabular_writer

(function from pyomo.common.formatting)

pyomo.common.formatting.tabular_writer(ostream, prefix, data, header, row_generator)[source]

Output data in tabular form

Parameters:
  • ostream (io.TextIOBase) – the stream to write to

  • prefix (str) – prefix each generated line with this string

  • data (iterable) – an iterable object that returns (key, value) pairs (e.g., from iteritems()) defining each row in the table

  • header (List[str]) – list of column headers

  • row_generator (function) – a function that accepts the key and value from data and returns either a tuple defining the entries for a single row, or a generator that returns a sequence of table rows to be output for the specified key