gcubed.projections.derivation

Provides capacity to augment charting projections with derived variable projections

class Derivation(gcubed.base.Base):

Overview

Provides convenience methods for all classes.

All G-Cubed classes inherit from this base class.

Derivation( prefix: str, description: str, units: str, deviation_units: str, prefix_of_existing_variable_with_same_domain: str, projection_function: Callable[[pandas.core.frame.DataFrame], pandas.core.frame.DataFrame], deviation_function: Callable[[pandas.core.frame.DataFrame, pandas.core.frame.DataFrame], pandas.core.frame.DataFrame])

Overview

Sets up a derived variable to the projections object

Arguments

  • prefix: The prefix for the derived variable

  • description: The description of the derived variable

  • prefix_of_existing_variable_with_same_domain: The variable name prefix of the variable in the database that has the same domain definition (it is defined over the same sets, in the same order).

  • projection_function: The function that calculates the derived variable. The function should take a single argument, the charting projections dataframe, and return the projections of the derived variable as dataframe.

  • deviation_function: The function that calculates deviations. The function should take two dataframe arguments.

For the deviations function:

  • The first argument is a charting projections dataframe that contains the original projections for the derived variable.
  • The second argument is a charting projections dataframe that contains the new projections for the derived variable.

The dataframes passed in the two arguments must have the same projection years and the projections for the same variables.

The deviations function must compute and return the deviations of the new projections for the derived variable from the original projections for the derived variable.

prefix: str

Returns

  • str: The prefix for the derived variable
description: str

Returns

  • str: The description of the derived variable
units: str

Returns

  • str: The units of the derived variable
deviation_units: str

Returns

  • str: The deviation units of the derived variable
prefix_of_existing_variable_with_same_domain: str

Returns

  • str: The prefix of the existing variable with the same domain
projection_function: <built-in function callable>

Returns

  • callable: The function that calculates the derived variable
deviation_function: <built-in function callable>

Returns

  • callable: The function that calculates deviations
details: pandas.core.series.Series

Returns

The details of the derived variable