iode.ComputedTable.is_editable

ComputedTable.is_editable(row: int | str, column: int | str) bool[source]

Check if a cell in the computed table is editable.

A cell is not editable if:

  1. the corresponding column contains on operation on periods or files

  2. the corresponding column does not refer to the current workspace

  3. the corresponding LEC expression from the original table starts with 0+

  4. the corresponding LEC expression from the original table does not refer to at least one variable

Parameters:
rowint or str

The row passed as position (int) or as name (str).

columnint or str

The column passed as position (int) or as name (str).

Returns:
bool: True if the cell is editable, False otherwise.

Examples

>>> from iode import SAMPLE_DATA_DIR
>>> from iode import Table, comments, variables
>>> comments.load(f"{SAMPLE_DATA_DIR}/fun.cmt")
Loading .../fun.cmt
317 objects loaded 
>>> variables.load(f"{SAMPLE_DATA_DIR}/fun.var")
Loading .../fun.var
394 objects loaded
>>> title = "Example Table"
>>> lecs = ["Q_F", "Q_I", "Q_F/Q_I", "ln(Q_I+Q_F)", "KNFF", "KNFF[-1]", "3+ln(10)", "0+KNFF"]
>>> table = Table(2, title, lecs)
>>> table
DIVIS | 1             |
TITLE |       "Example Table"
----- | ---------------------------
CELL  |               |     "#S"
----- | ---------------------------
CELL  | "Q_F"         |         Q_F
CELL  | "Q_I"         |         Q_I
CELL  | "Q_F/Q_I"     |     Q_F/Q_I
CELL  | "ln(Q_I+Q_F)" | ln(Q_I+Q_F)
CELL  | "KNFF"        |        KNFF
CELL  | "KNFF[-1]"    |    KNFF[-1]
CELL  | "3+ln(10)"    |    3+ln(10)
CELL  | "0+KNFF"      |      0+KNFF

nb lines: 12
nb columns: 2
language: 'ENGLISH'
gridx: 'MAJOR'
gridy: 'MAJOR'
graph_axis: 'VALUES'
graph_alignment: 'LEFT'
>>> # compute table
>>> computed_table = table.compute("(2010;2010/2009)[1;2]:2", extra_files=f"{SAMPLE_DATA_DIR}/ref.av")
>>> computed_table
 line title \ period[file]  | 2010[1]  | 2010[2]  | 2010/2009[1] | 2010/2009[2] | 2011[1]  | 2011[2]  | 2011/2010[1] | 2011/2010[2]
------------------------------------------------------------------------------------------------------------------------------------
Q_F                         |  5842.74 |  5725.89 |         1.90 |         1.90 |  5930.75 |  5812.13 |         1.51 |         1.51
Q_I                         |  1093.37 |  1071.50 |         0.89 |         0.89 |  1114.60 |  1092.30 |         1.94 |         1.94
Q_F/Q_I                     |     5.34 |     5.34 |         1.00 |         1.00 |     5.32 |     5.32 |        -0.43 |        -0.43
ln(Q_I+Q_F)                 |     8.84 |     8.82 |         0.20 |         0.20 |     8.86 |     8.84 |         0.18 |         0.18
KNFF                        | 11525.01 | 11294.51 |         2.05 |         2.05 | 11736.78 | 11502.05 |         1.84 |         1.84
KNFF[-1]                    | 11293.85 | 11067.97 |         2.82 |         2.82 | 11525.01 | 11294.51 |         2.05 |         2.05
3+ln(10)                    |     5.30 |     5.30 |         0.00 |         0.00 |     5.30 |     5.30 |         0.00 |         0.00
0+KNFF                      | 11525.01 | 11294.51 |         2.05 |         2.05 | 11736.78 | 11502.05 |         1.84 |         1.84
>>> computed_table.is_editable("Q_F", "2011[1]")
True
>>> # 1. cell is not editable if the corresponding column contains on operation on periods or files
>>> computed_table.is_editable("Q_F", "2010/2009[1]")
False
>>> # 2. cell is not editable if the corresponding column does not refer to the current workspace
>>> computed_table.is_editable("Q_F", "2011[2]")
False
>>> # 3. cell is not editable if the corresponding LEC expression from the original table starts with 0+
>>> computed_table.is_editable("0+KNFF", "2011[1]")
False
>>> # 4. cell is not editable if the corresponding LEC expression from the original table 
>>> #    does not refer to at least one variable
>>> computed_table.is_editable("3+ln(10)", "2011[1]")
False