gcubed.io_data

This module contains the IOData class for input/output table access.

tax_input: str = 'TAX'

The tax row label.

labor_input: str = 'L'

The labor row label.

capital_input: str = 'K'

The capital row label.

consumption_use: str = 'C'

The consumption column label.

investment_use: str = 'I'

The investment column label.

government_use: str = 'G'

The government spending column label.

exports_use: str = 'X'

The exports column label.

imports_use: str = 'M'

The imports column label.

non_sector_uses: list[str] = ['C', 'I', 'G', 'X', 'M']

The list of non-sector uses in the IO tables.

non_sector_inputs: list[str] = ['L', 'K', 'TAX']

The list of non-sector inputs in the IO tables.

class IOData(gcubed.base.Base):

Overview

This class manages loading and provision of IO table information.

It encapsulates all of the information about the input/output tables for each region.

IOData(sym_data: gcubed.sym_data.SymData)

Arguments

sym_data: The information about the SYM model definition.

This argument also provides access to the model configuration so that the location of the CSV file containing the IO tables data is known.

CSV file format

The .csv contains the Input/Output tables for all regions.

Each region has an Input/Output table.

The Input/Output tables are stacked vertically in the Input/Output tables file.

The first column of the IO table, with the <REGION_CODE> in the first cell, must be in the first column of the CSV file.

Each Input/Output table has the following structure, repeated down the file for each region:

<REGION_CODE> a01 a0N C I G X M
g01
:
g0N
L
K
TAX

The region code in the left corner is mandatory. It must be exactly the same as the region code used for the region in the SYM set of regions in the model definition. It is used to locate the Input/Output table for the region when the table is loaded.

The first row and the first column of the table are labels for the rows and columns respectively.

Columns of the table describe 'uses' by a particular sector or for one of the following:

  • Consumption - C
  • Investment - I
  • Government spending - G
  • Exports - X
  • Imports - M

The sector labels must be the sector identifiers in the set of sectors in the SYM model definition. Typically these are a01 for sector 1 etc.

Rows of the table describe 'inputs' by type of sectoral good (service) produced or:

  • Labour - L
  • Capital - K
  • Tax - TAX

The goods labels must be the good identifiers in the set of goods in the SYM model definition. Typically these are g01 for sector 1 etc.

The SYM details of the model.

def io_table(self, region: str) -> pandas.core.frame.DataFrame:

Overview

Use this function to retrieve the IO table content for a single region. That IO table can then be analysed using the input (row) index and the output (column) label for the rows and columns of the dataframe that is the IO table.

Arguments

region: the identifier for the region of interest.

Returns

The dataframe containing the input/output table for the specified region.

def has_io_table(self, region: str) -> bool:

Overview

Checks if there is an IO table for the given region.

Arguments

region: The region of interest.

Returns

True if there is an IO table for the specified region and False otherwise.

io_table_inputs

The row names (one per input) in the IO tables. All regions have the same rows in their IO tables.

io_table_tax: str

Returns the tax row label.

io_table_labour: str

The labour row label.

io_table_capital: str

The capital row label.

io_table_consumption: str

The consumption column label.

io_table_investment: str

The investment column label.

io_table_government: str

The government spending column label.

io_table_exports: str

The exports column label.

io_table_imports: str

The imports column label.

io_table_uses

The column names, one column for each output in the IO tables. The IO table has the same columns for each region.

dataframe: pandas.core.frame.DataFrame

Returns

The IO tables as a a single dataframe.

The dataframe has a single column index that is the IO table uses.

The dataframe has a row multi-index with:

  • level 0 being the region
  • level 1 being the IO table inputs