gcubed.projections

This module contains the simulation experiment and projection functionality.

It also provides functions for :

  1. computing differences between two sets of projections
  2. computing percentage deviations between two sets of projections
  3. obtaining an extract from a set of projections
def extract( projections: pandas.core.frame.DataFrame, variable_name_prefixes: list[str] = None, years: list = None) -> pandas.core.frame.DataFrame:

Overview

Generates an extract of a projections dataframe.

Arguments

projections: A dataframe of projections - annotated or not annotated.

variable_name_prefixes: A list of the prefixes for the variable names to include in the extract. Defaults to None which means that all variables will be included in the extract.

years: A list of the years to include in the extract. Defaults to None which means that all years will be included in the extract.

Returns

A dataframe of the extract from the projections.

Exceptions

If the inputs are not valid, an exception is raised.

def differences( new_projections: pandas.core.frame.DataFrame, original_projections: pandas.core.frame.DataFrame) -> pandas.core.frame.DataFrame:

Overview

Subtracts the second set of projections from the first set of projections.

No changes are made to the units of the original projections.

Arguments

new_projections: A dataframe of projections

original_projections: A second dataframe of projections

Produce a dataframe of differences between two projections (new_projections - original_projections).

Note that this can be used for raw, database, publishable and graphable projection types. However, the new and original projections must be the same type for the results to be meaningful.

Exceptions

Raises exceptions if the dataframes have different indexes or different columns.

def deviations( new_projections: gcubed.projections.projections.Projections, original_projections: gcubed.projections.projections.Projections) -> pandas.core.frame.DataFrame:

Overview

Computes deviations between the new and original projections. The form of deviation that is computed depends on the units of the variables and the variables themselves.

Arguments

new_projections: The new projections

original_projections: The original projections

charting: True if the deviations are to be used for charting with the hypercube charting system. Defaults to False.

Returns

A dataframe of the deviations of the new publishable projections from the original publishable projections.

The units for the resulting deviations are determined by the nature of the deviation that is computed.

Exceptions

Raises exceptions if the dataframes have different indexes or different columns.

Raises exceptions if the dataframes are not annotated publishable projections.

def adjusted_publishable_projections( original_projections: gcubed.projections.projections.Projections) -> pandas.core.frame.DataFrame:

Overview

Ensures GDP aggregates add up across consumption, investment government and trade.

Arguments

original_projections: A a projections object that provides access to model details as well as the publishable projections that are to be adjusted.

Returns

A dataframe of adjusted publishable projections in levels.