gcubed.projections
This module contains the simulation experiment and projection functionality.
It also provides functions for :
- computing differences between two sets of projections
- computing percentage deviations between two sets of projections
- obtaining an extract from a set of projections
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.
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.
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.
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.