iode.Table

class iode.Table

IODE tables are objects designed to present variables and scalars (results or data) in the form of tables of figures or graphs. They are defined as a set of lines of various types (title, formula, dividers, etc.). These lines contain formulas that will be calculated when printed, based on the values in the series, for example after a simulation. IODE tables therefore do not contain numbers, but rather the formulas that will be used to calculate the values to be printed in the tables.

Each line in a table has a set of attributes, the most important of which is its type. This type determines how the line will be printed, and the possible contents of the line definition. The other attributes concern the type of characters to be used when printing and the framing of the line. The table also contains graphic attributes that concern the layout of the graphic that will eventually be built with this 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.

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")
>>> lists.load(f"{SAMPLE_DATA_DIR}/fun.lst")
>>> variables.load(f"{SAMPLE_DATA_DIR}/fun.var")
>>> # 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'
>>> # the first cell represents a line title and the second a LEC expression
>>> table_title = "Table example with titles on the left and LEC expressions on the right"
>>> lines_titles = ["GOSG:", "YDTG:", "DTH:", "DTF:", "IT:", "YSSG+COTRES:", "RIDG:", "OCUG:"]
>>> 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'
Attributes:
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: TableGraphAlign

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(self, generalized_sample[, ...])

Compute the values corresponding to LEC expressions in cells.

index(self, key)

Return the index of the line containing the string key.

insert(self, index, value)

Insert a new line in the table.

__init__(*args, **kwargs)

Methods

__init__(*args, **kwargs)

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

Compute the values corresponding to LEC expressions in cells.

index(self, key)

Return the index of the line containing the string key.

insert(self, index, value)

Insert a new line in the table.

Attributes

box

box: bool

graph_alignment

graph_alignment: str

graph_axis

graph_axis: str

gridx

gridx: str

gridy

gridy: str

language

language: str

nb_columns

nb_columns: int

nb_lines

nb_lines: int

shadow

shadow: bool

ymax

ymax: float

ymin

ymin: float