gcubed.projections.derivations
Provides capacity to augment charting projections with derived variable projections
Overview
Provides convenience methods for all classes.
All G-Cubed classes inherit from this base class.
Constructor
Does constructor operations required by all classes that inherit from this base class.
These currently just set up numpy array print options.
Returns
dict[str, Derivation]
: The derivations that have been added to the projections object
Overview
Checks if a derivation object has been added to the projections object.
Arguments
prefix (str)
: The prefix of the derivation object
Returns
bool
: Whether the derivation object has been added to the projections object
Overview
Adds a derived variable to the projections object
Arguments
derivation (Derivation)
: The derivation object that defines the derived variableforce (bool)
: Whether to add the derivation even if it already exists in this collection of derivations. Defaults toFalse
in which case the derivation is only added if there is not an existing derivation definition that is already available.
Overview
Adds multiple derived variables to the projections object if they do not already have an existing derivation.
Arguments
derivations (list[Derivation])
: The derivation objects that define the derived variablesforce (bool)
: Whether to add the derivation even if it already exists in this collection of derivations. Defaults toFalse
in which case the derivation is only added if there is not an existing derivation definition that is already available.
Overview
Gets a derivation object by its prefix.
Arguments
prefix (str)
: The prefix of the derivation object
Returns
Derivation
: The derivation object
Overview
Gets all the derivation objects that have been added to the projections object.
Returns
list[Derivation]
: The derivation objects
Returns
A dataframe with details about the derivation definitions that are available.
Overview
Derives all the projections for all the derived variables that have been added to the projections object.
Arguments
original_projections
: The original projections. These MUST be level projections rather than deviations and they MUST be obtained using thecharting_projections
property of the relevantProjections
object.
Returns
The derived variable projections.
Exceptions
ValueError
: If the original projections do not include the column labels associated with charting projections.
Overview
Calculates the derived variable projections and adds them to the derived variable projections dataframe.
Overview
Derives all the projected deviations for the derived variables.
The deviations are of the new projections from the original projections.
Arguments
new_projections
: The new projectionsoriginal_projections
: The original projections
Returns
The derived deviations of the new projections from the original projections.
Overview
Calculates the derived variable deviations and adds them to the derived variable deviations dataframe.
Arguments
derivation (Derivation)
: The derivation object that defines the derived variablenew_projections (pd.DataFrame)
: The new projectionsoriginal_projections (pd.DataFrame)
: The original projections
Returns
The derived variable deviations of the new projections from the original projections.