iode.Tables.i
- property Tables.i: PositionalIndexer
Allow to select the ith table in the database.
Examples
>>> from iode import tables, SAMPLE_DATA_DIR, TableLineType >>> tables.load(f"{SAMPLE_DATA_DIR}/fun.tbl") Loading .../fun.tbl 46 objects loaded >>> # get the first table >>> tables.i[0] DIVIS | 1 | TITLE | "Déterminants de la croissance de K" ----- | ------------------------------------------------------------------ CELL | | "#s" ----- | ------------------------------------------------------------------ CELL | "Croissance de K " | dln KNFF CELL | "Output gap " | knff1*ln (QAFF_/(Q_F+Q_I)) CELL | "Rentabilité " | knf2*ln mavg(3,RENT) CELL | "Croissance anticipée de l'output" | 0.416*mavg(4,dln QAFF_)+0.023 nb lines: 8 nb columns: 2 language: 'ENGLISH' gridx: 'MAJOR' gridy: 'MAJOR' graph_axis: 'VALUES' graph_alignment: 'LEFT' >>> # get the last table >>> tables.i[-1] DIVIS | 1 | PC_*40.34 TITLE | "Tableau B-3. Revenu disponible des ménages à prix constant" ----- | --------------------------------------------------------------------------------------------------------- CELL | | "#S" CELL | "Revenus primaires" | WBU_+YN+GOSH_+IDH CELL | " Masse salariale totale" | WBU_ CELL | " Revenu net du travail en provenance du Reste du monde" | YN CELL | " Surplus brut d'exploitation" | GOSH_ CELL | " Revenu net de la propriété" | IDH CELL | "Cotisations sociales et impôts" | SSF+SSH+DTH CELL | " Cotisations patronales" | SSF CELL | " Cotisations personnelles" | SSH CELL | "IPP" | DTH CELL | "Prestations sociales " | SBH+OCUH CELL | " Sécurité sociale" | SBH CELL | " Diverses prestations" | OCUH CELL | "Total" | (WBU_+YN+GOSH_+IDH)-(SSF+SSH+DTH)+(SBH+OCUH) ----- | --------------------------------------------------------------------------------------------------------- FILES | DATE | nb lines: 19 nb columns: 2 language: 'ENGLISH' gridx: 'MAJOR' gridy: 'MAJOR' graph_axis: 'VALUES' graph_alignment: 'LEFT' >>> # update first table >>> table = tables.i[0] >>> table += '-' >>> table += TableLineType.DATE >>> tables.i[0] = table >>> tables.i[0] DIVIS | 1 | TITLE | "Déterminants de la croissance de K" ----- | ------------------------------------------------------------------ CELL | | "#s" ----- | ------------------------------------------------------------------ CELL | "Croissance de K " | dln KNFF CELL | "Output gap " | knff1*ln (QAFF_/(Q_F+Q_I)) CELL | "Rentabilité " | knf2*ln mavg(3,RENT) CELL | "Croissance anticipée de l'output" | 0.416*mavg(4,dln QAFF_)+0.023 ----- | ------------------------------------------------------------------ DATE | nb lines: 10 nb columns: 2 language: 'ENGLISH' gridx: 'MAJOR' gridy: 'MAJOR' graph_axis: 'VALUES' graph_alignment: 'LEFT' >>> # update last table >>> table = tables.i[-1] >>> table += TableLineType.MODE >>> tables.i[-1] = table >>> tables.i[-1] DIVIS | 1 | PC_*40.34 TITLE | "Tableau B-3. Revenu disponible des ménages à prix constant" ----- | --------------------------------------------------------------------------------------------------------- CELL | | "#S" CELL | "Revenus primaires" | WBU_+YN+GOSH_+IDH CELL | " Masse salariale totale" | WBU_ CELL | " Revenu net du travail en provenance du Reste du monde" | YN CELL | " Surplus brut d'exploitation" | GOSH_ CELL | " Revenu net de la propriété" | IDH CELL | "Cotisations sociales et impôts" | SSF+SSH+DTH CELL | " Cotisations patronales" | SSF CELL | " Cotisations personnelles" | SSH CELL | "IPP" | DTH CELL | "Prestations sociales " | SBH+OCUH CELL | " Sécurité sociale" | SBH CELL | " Diverses prestations" | OCUH CELL | "Total" | (WBU_+YN+GOSH_+IDH)-(SSF+SSH+DTH)+(SBH+OCUH) ----- | --------------------------------------------------------------------------------------------------------- FILES | DATE | MODE | nb lines: 20 nb columns: 2 language: 'ENGLISH' gridx: 'MAJOR' gridy: 'MAJOR' graph_axis: 'VALUES' graph_alignment: 'LEFT'