iode.Table

class iode.Table(nb_columns: int = 2, table_title: str = '', lecs_or_vars: str | List[str] = None, lines_titles: List[str] = None, mode: bool = False, files: bool = False, date: bool = False)[source]

One of the most frequently performed operations during a simulation exercise is the display of tables of results and charts.

Each IODE table is a set of lines. A line is composed of two parts (in general):

  • a text part, which will be the title of the line

  • a formula part, which will allow the calculation of the numerical values to be placed in the computed table:

Parameters:
nb_columnsint

The number of columns in the IODE table. Defaults to 2.

table_titlestr, optional

The title of the table or the name of the IODE Comment that must become the title. Defaults to empty.

lecs_or_varsstr or List[str], optional

The LEC formulas of the lines or the list of variable names. If it represents a list of variables, the associated line title for each variable will be the IODE comment with the same name if it exists, the name of the variable otherwise.

lines_titles: list(str), optional

Titles of the lines. If None, the arguments ‘lecs_or_vars’ is assumed to represents a list of variables.

modebool, optional

Whether or not to add a ‘MODE’ line to the table. Defaults to False.

filesbool, optional

Whether or not to add a ‘FILES’ line to the table. This line contains the files used to display the values of the computed table. Defaults to False.

datebool, optional

Whether or not to add a ‘DATE’ line to the table. This line contains the date when the table has been computed. Defaults to False.

Attributes:
title: str

The title of the table.

ymin: float

Minimum values on the Y axis. If data falls outside these values, the axis scale adapts to the data. The value \(NA\) can be set for ymin and/or ymax: in this case, the graphics program will calculate an optimum scale value.

ymax: float

Maximum values on the Y axis. If data falls outside these values, the axis scale adapts to the data. The value \(NA\) can be set for ymin and/or ymax: in this case, the graphics program will calculate an optimum scale value.

gridx: TableGraphGrid

X-grid options: MAJOR, NONE or MINOR.

gridy: TableGraphGrid

Y-grid options: MAJOR, NONE or MINOR.

graph_axis: TableGraphAxis

Y-axis scale: VALUES, LOG, SEMILOG or PERCENT.

graph_alignment: TableTextAlign

Graph alignment: LEFT, CENTER or RIGHT.

box: bool

Whether the graph should be boxed.

shadow: bool

Whether or not to place a shadow behind the chart.

Methods

compute(generalized_sample[, extra_files, ...])

Compute the values corresponding to LEC expressions in cells.

copy()

Return a copy of the current Table.

index(key)

Return the index of the line containing the string key.

insert(index, value)

Insert a new line in the table.

plot([title, plot_type, grid, y_log, y_min, ...])

Plot the table using the sample of the variables workspace.

from_cython_obj

Returns:
Table

See also

TableCell
TableLine

Examples

>>> from iode import SAMPLE_DATA_DIR
>>> from iode import Table, comments, lists, variables
>>> comments.load(f"{SAMPLE_DATA_DIR}/fun.cmt")
Loading .../fun.cmt
317 objects loaded 
>>> lists.load(f"{SAMPLE_DATA_DIR}/fun.lst")
Loading .../fun.lst
17 objects loaded 
>>> variables.load(f"{SAMPLE_DATA_DIR}/fun.var")
Loading .../fun.var
394 objects loaded 
>>> # empty table
>>> table = Table()
>>> table
DIVIS | 1 |
TITLE |
----- | --------
CELL  |   | "#S"
----- | --------

nb lines: 4
nb columns: 2
language: 'ENGLISH'
gridx: 'MAJOR'
gridy: 'MAJOR'
graph_axis: 'VALUES'
graph_alignment: 'LEFT'
>>> # left column = line title
>>> # right column = variable or LEC expression
>>> table_title = "Table example with titles on the left and LEC expressions on the right"
>>> # content of the left column
>>> lines_titles = ["GOSG:", "YDTG:", "DTH:", "DTF:", "IT:", "YSSG+COTRES:", "RIDG:", "OCUG:"]
>>> # content of the right column
>>> lines_lecs = ["GOSG", "YDTG", "DTH", "DTF", "IT", "YSSG+COTRES", "RIDG", "OCUG"]
>>> table = Table(2, table_title, lines_lecs, lines_titles, True, True, True)
>>> table
DIVIS | 1              |
TITLE | "Table example with titles on the left and LEC expressions on the right"
----- | ------------------------------------------------------------------------
CELL  |                |     "#S"
----- | ------------------------------------------------------------------------
CELL  | "GOSG:"        |        GOSG
CELL  | "YDTG:"        |        YDTG
CELL  | "DTH:"         |         DTH
CELL  | "DTF:"         |         DTF
CELL  | "IT:"          |          IT
CELL  | "YSSG+COTRES:" | YSSG+COTRES
CELL  | "RIDG:"        |        RIDG
CELL  | "OCUG:"        |        OCUG
----- | ------------------------------------------------------------------------
MODE  |
FILES |
DATE  |

nb lines: 16
nb columns: 2
language: 'ENGLISH'
gridx: 'MAJOR'
gridy: 'MAJOR'
graph_axis: 'VALUES'
graph_alignment: 'LEFT'
>>> # if the argument 'lines_titles' is not used, the argument 'lecs_or_vars' represents 
>>> # a list of variables.
>>> table_title = "Table example with variables only"
>>> # the element '$ENVI' of 'lines_vars' below represents the IODE list 'ENVI' and will 
>>> # be automatically expanded to its contained variables when passed to the Table constructor 
>>> lines_vars = ["GOSG", "YDTG", "DTH", "DTF", "IT", "YSSG", "COTRES", "RIDG", "OCUG", "$ENVI"]
>>> table = Table(2, table_title, lines_vars, mode=True, files=True, date=True)
>>> table
DIVIS | 1                                                                    |
TITLE |                      "Table example with variables only"
----- | ------------------------------------------------------------------------------
CELL  |                                                                      |   "#S"
----- | ------------------------------------------------------------------------------
CELL  | "Bruto exploitatie-overschot: overheid (= afschrijvingen)."          |    GOSG
CELL  | "Overheid: geïnde indirecte belastingen."                            |    YDTG
CELL  | "Totale overheid: directe belasting van de gezinnen."                |     DTH
CELL  | "Totale overheid: directe vennootschapsbelasting."                   |     DTF
CELL  | "Totale indirecte belastingen."                                      |      IT
CELL  | "Globale overheid: ontvangen sociale zekerheidsbijdragen."           |    YSSG
CELL  | "Cotisation de responsabilisation."                                  |  COTRES
CELL  | "Overheid: inkomen uit vermogen."                                    |    RIDG
CELL  | "Globale overheid: saldo van de ontvangen lopendeoverdrachten."      |    OCUG
CELL  | "Wisselkoers van de USD t.o.v. de BEF (jaargemiddelde)."             |      EX
CELL  | "Index wereldprijs - invoer van niet-energieprodukten, inUSD."       |   PWMAB
CELL  | "Index wereldprijs - invoer van diensten, in USD."                   |    PWMS
CELL  | "Index wereldprijs - uitvoer van niet-energieprodukten, inUSD."      |   PWXAB
CELL  | "Index wereldprijs - uitvoer van diensten, in USD."                  |    PWXS
CELL  | "Indicator van het volume van de wereldvraag naar goederen,1985=1."  |   QWXAB
CELL  | "Indicator van het volume van de wereldvraag naar diensten,1985=1."  |    QWXS
CELL  | "Brent olieprijs (USD per barrel)."                                  |    POIL
CELL  | "Totale beroepsbevolking (jaargemiddelde)."                          |    NATY
CELL  | "TFPFHP_"                                                            | TFPFHP_
----- | ------------------------------------------------------------------------------
MODE  |
FILES |
DATE  |

nb lines: 27
nb columns: 2
language: 'ENGLISH'
gridx: 'MAJOR'
gridy: 'MAJOR'
graph_axis: 'VALUES'
graph_alignment: 'LEFT'
>>> # variables or LEC expressions can be also passed as a single string
>>> lines_vars = "GOSG;YDTG;DTH;DTF;IT;YSSG;COTRES;RIDG;OCUG;$ENVI"
>>> table_title = "Table example with all variables passed as a single string"
>>> table = Table(2, table_title, lines_vars, mode=True, files=True, date=True)
>>> table
DIVIS | 1                                                                    |
TITLE |          "Table example with all variables passed as a single string"
----- | ------------------------------------------------------------------------------
CELL  |                                                                      |   "#S"
----- | ------------------------------------------------------------------------------
CELL  | "Bruto exploitatie-overschot: overheid (= afschrijvingen)."          |    GOSG
CELL  | "Overheid: geïnde indirecte belastingen."                            |    YDTG
CELL  | "Totale overheid: directe belasting van de gezinnen."                |     DTH
CELL  | "Totale overheid: directe vennootschapsbelasting."                   |     DTF
CELL  | "Totale indirecte belastingen."                                      |      IT
CELL  | "Globale overheid: ontvangen sociale zekerheidsbijdragen."           |    YSSG
CELL  | "Cotisation de responsabilisation."                                  |  COTRES
CELL  | "Overheid: inkomen uit vermogen."                                    |    RIDG
CELL  | "Globale overheid: saldo van de ontvangen lopendeoverdrachten."      |    OCUG
CELL  | "Wisselkoers van de USD t.o.v. de BEF (jaargemiddelde)."             |      EX
CELL  | "Index wereldprijs - invoer van niet-energieprodukten, inUSD."       |   PWMAB
CELL  | "Index wereldprijs - invoer van diensten, in USD."                   |    PWMS
CELL  | "Index wereldprijs - uitvoer van niet-energieprodukten, inUSD."      |   PWXAB
CELL  | "Index wereldprijs - uitvoer van diensten, in USD."                  |    PWXS
CELL  | "Indicator van het volume van de wereldvraag naar goederen,1985=1."  |   QWXAB
CELL  | "Indicator van het volume van de wereldvraag naar diensten,1985=1."  |    QWXS
CELL  | "Brent olieprijs (USD per barrel)."                                  |    POIL
CELL  | "Totale beroepsbevolking (jaargemiddelde)."                          |    NATY
CELL  | "TFPFHP_"                                                            | TFPFHP_
----- | ------------------------------------------------------------------------------
MODE  |
FILES |
DATE  |

nb lines: 27
nb columns: 2
language: 'ENGLISH'
gridx: 'MAJOR'
gridy: 'MAJOR'
graph_axis: 'VALUES'
graph_alignment: 'LEFT'
__init__(nb_columns: int = 2, table_title: str = '', lecs_or_vars: str | List[str] = None, lines_titles: List[str] = None, mode: bool = False, files: bool = False, date: bool = False) Self[source]

Methods

__init__([nb_columns, table_title, ...])

compute(generalized_sample[, extra_files, ...])

Compute the values corresponding to LEC expressions in cells.

copy()

Return a copy of the current Table.

from_cython_obj(obj)

index(key)

Return the index of the line containing the string key.

insert(index, value)

Insert a new line in the table.

plot([title, plot_type, grid, y_log, y_min, ...])

Plot the table using the sample of the variables workspace.

Attributes

box

Whether the graph should be boxed.

coefficients

Get the list of coefficients (scalars) associated with all cells of type 'LEC' of the table.

divider

Returns the divider line of the table.

graph_alignment

Graph alignment of the table.

graph_axis

Graph axis of the table allows you to select the type of axis:

gridx

The gridx value of the table offers a choice of three X-grid options:

gridy

The gridy value of the table offers a choice of three Y-grid options:

language

Language.

nb_columns

nb_lines

shadow

Whether or not to place a shadow behind the chart.

title

Title of the table.

variables

Get the list of variables associated with all cells of the type 'LEC' of the table.

ymax

Maximum values on the Y axis.

ymin

Minimum values on the Y axis.