iode.TableCell
- class iode.TableCell[source]
IODE Table cell.
Cells in TITLE and CELL lines can contain text. Cells in CELL lines can also contain LEC expressions. Cells of other line types (SEP, FILES, MODE and DATE) do not contain any information, as this would not result in printing.
Interpolation Of Text Cells
Text cells in a table can contain expressions that adapt to the sample when printed. These expressions are composed of the ‘#’ character, followed by a letter and optionally a number:
The letter indicates the value to be taken: ‘y’ for the year, for example.
The number indicates the period to be taken into account. In fact, several periods may be involved in calculating the column (80/79, for example). 80 will correspond to period 1, and 79 to period 2, so the number can take the values 1 and 2.
Some expressions do not need a number. For example, ‘#O’ indicates the operation performed on the years (like growth rate) and must not be followed by 1 or 2.
If one expression is not followed by a number, then the value 1 is used for the number.
The expressions can contain:
:Attributes:
- cell_type: TableCellType
Type of cell content. Possible value is STRING or LEC.
- align: TableCellAlign
Alignment of the text in the cell. Possible values are CENTER, LEFT, RIGHT or DECIMAL.
- bold: bool
- italic: bool
- underline: bool
Methods
from_cython_obj
Warning
To distinguish a STRING cell from a LEC cell, the text of a STRING cell must begin with double quotation marks (which will not be printed). A cell that does not begin with a double quotation mark will be considered a LEC form and syntactically verified.
Examples
>>> from iode import SAMPLE_DATA_DIR >>> from iode import tables, Table >>> tables.load(f"{SAMPLE_DATA_DIR}/fun.tbl") Loading .../fun.tbl 46 objects loaded >>> table = tables["ANAPRIX"] >>> table DIVIS | 1 | TITLE | "Analyse des prix" ----- | --------------------------------------------------------------- CELL | | "#s" ----- | --------------------------------------------------------------- CELL | "GAP_" | GAP_ CELL | "dln (PC/(1+ITCR))-dln AOUC" | 100*(dln (PC/(1+ITCR))-dln AOUC) nb lines: 6 nb columns: 2 language: 'ENGLISH' gridx: 'MAJOR' gridy: 'MAJOR' graph_axis: 'VALUES' graph_alignment: 'LEFT'
>>> table[4] ('"GAP_"', 'GAP_') >>> # first cell >>> table[4][0] "GAP_" >>> table[4][0].cell_type 'STRING' >>> # second cell >>> table[4][1] GAP_ >>> table[4][1].cell_type 'LEC'
Methods
__init__()from_cython_obj(obj)Attributes
Alignment of the text in the cell.
Whether or not the cell text is bold.
Type of the content of the cell.
Get the list of coefficients (scalars) associated with the LEC expression of a cell of type 'LEC'.
Whether or not the cell text is italic.
Whether or not the cell text is underline.
Get the list of variables associated with the LEC expression of a cell of type 'LEC'.