iode.TableLine.__setitem__

TableLine.__setitem__(index, value)[source]

Update the content of a cell of the line.

Parameters:
index: int

index of the cell.

value: str or TableCell

new content of the cell.

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'
>>> # warning: content of cells of type 'STRING' must be surrounded by double quotes
>>> table[5][0] = '"dln(PC/ITCR) - dln AOUC"'
>>> table[5][0]
"dln(PC/ITCR) - dln AOUC"
>>> # warning: if the new content is not surrounded by double quotes, 
>>> #          it is considerer as 'LEC' cell
>>> table[5][1] = '100*(dln(PC / ITCR) - dln AOUC)'
>>> table[5][1]
100*(dln(PC / ITCR) - dln AOUC)