gcubed.base
This module contains the Base
class.
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.
Overview
Create a dataframe filled with zeros.
Arguments
rows: the number of dataframe rows
cols: the number of dataframe columns
Returns
A dataframe containing zeros with the given number of rows and the given number of columns.
Overview
Loads data from a CSV file, splitting it into two parts, the data selected as the columns with a 4 digit column name, and the non-data, selected as all other columns.
This is used to load a variety of different CSV data sources.
Arguments
filename: the name of the CSV file, including the path relative to the model root directory.
name_column: the column of the CSV file that contains the variable names, indexed from zero for the first column and defaulting to 1.
Returns
A tuple is returned. The first element in the tuple is the dataframe consisting of all columns that were loaded and that did not have a year label for the column. The second element in the tuple is the dataframe consisting of all columns that were loaded and that did have a year label for the column.
Exceptions
Raises an exception if the file has no contents.