iode.Variables
- class iode.Variables(filepath: str = None)[source]
IODE Variables database.
- Parameters:
- filepath: str, optional
file containing the IODE variables to load.
- Attributes:
- filename: str
- description: str
- mode: int
- sample: Sample
- nb_periods: int
- periods: list(str)
- periods_as_float: list(float)
Methods
clear()Delete all objects from the current database.
compare(filepath[, ...])The objects of the current database are compared with those stored in the file filepath.
convert_file(input_file, input_format, ...)Convert an external file representing IODE variables to an IODE variables file (.var).
copy([pattern])Create a new Variables database in which each variable is a copy of the original variable from the global Variables workspace.
copy_from(input_files[, from_period, ...])Copy (a subset of) variables from the input file(s) 'input_files' into the current database.
execute_RAS(pattern, xdim, ydim, ref_year, ...)Execute the RAS algorithm (also called IPF for 'Iterative Proportional Fitting').
export_as_file(variables_file, rule_file, ...)Convert an IODE Variables file to a format used by some other programs.
extrapolate(method[, from_period, ...])Extrapolate variables using one the method described below, based on previous periods.
from_array(array[, time_axis_name, sep])Copies the Array array into the IODE Variables database.
from_frame(df)Copy the pandas DataFrame df into the IODE Variables database.
from_numpy(data[, vars_names, first_period, ...])Copy the numpy ndarray array into the IODE Variables database.
get_name(pos)Return the name of the IODE object at position pos in the database.
get_names([pattern, filepath])Returns the list of objects names given a pattern.
get_names_from_pattern(list_name, pattern, xdim)Generate an IODE list containing the names of objects that match a given pattern.
high_to_low(type_of_series, filepath, var_list)Build series of lower periodicity by (summing the / taking the average of the / taking the last observation of) sub-periods.
index(name)Return the position of the IODE object with name name in the database.
load(filepath)Load objects stored in file 'filepath' into the current database.
low_to_high(type_of_series, method, ...)Build series with higher periodicity for stock data (Unemployment, Debt, ...) or flow data (GNP, Deficit, ...).
merge(other[, overwrite])Merge the content of the 'other' database into the current database.
merge_from(input_file)Merge all objects stored in the input file 'input_file' into the current database.
Create a new empty detached database.
periods_subset([from_period, to_period, ...])Return a subset of the periods from the current Variables sample.
plot([names, periods, plot_type, title, ...])Plot the variables defined by names for the periods defined by periods.
print_to_file(filepath[, names, format])Print the list variables defined by names to the file filepath using the format format.
remove(names)Delete the object(s) named 'names' from the current database.
rename(old_name, new_name[, overwrite])Rename an object of the database.
save(filepath[, compress])Save objects of the current database into the file 'filepath'.
search(pattern[, word, case_sensitive, ...])Return a list of all objects from the current database having a specific pattern in their names or LEC expression, comment...
seasonal_adjustment(input_file[, eps_test, ...])Eliminate seasonal variations in monthly series (= variables).
subset(pattern, copy[, first_period, ...])Create a subset of the database filtered by a name pattern.
to_array(vars_axis_name, time_axis_name, ...)Creates an Array from the current IODE Variables database.
to_frame(vars_axis_name, time_axis_name, ...)Create a pandas DataFrame from the current Variables database.
to_numpy()Create a Numpy ndarray from the current Variables database.
trend_correction(input_file, lambda_[, ...])Implementation of the Hodrick-Prescott method for trend series (= variables) construction.
from_cython_obj
get_instance
- Returns:
- Variables
Examples
>>> from iode import variables, SAMPLE_DATA_DIR >>> variables.load(f"{SAMPLE_DATA_DIR}/fun.var") Loading .../fun.var 394 objects loaded >>> len(variables) 394 >>> variables Workspace: Variables nb variables: 394 filename: ...\tests\data\fun.var description: Modèle fun - Simulation 1 sample: 1960Y1:2015Y1 mode: LEVEL name 1960Y1 1961Y1 1962Y1 1963Y1 1964Y1 1965Y1 ... 2009Y1 2010Y1 2011Y1 2012Y1 2013Y1 2014Y1 2015Y1 ACAF na na na na na na ... -37.46 -37.83 -44.54 -55.56 -68.89 -83.34 -96.41 ACAG na na na na na na ... 27.23 28.25 29.28 30.32 31.37 32.42 33.47 AOUC na 0.25 0.25 0.26 0.28 0.29 ... 1.29 1.31 1.33 1.36 1.39 1.42 1.46 AOUC_ na na na na na na ... 1.23 1.25 1.27 1.30 1.34 1.37 1.41 AQC 0.22 0.22 0.22 0.23 0.24 0.25 ... 1.45 1.46 1.48 1.51 1.56 1.61 1.67 ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ZJ na na na na na na ... 1.49 1.51 1.53 1.56 1.59 1.63 1.67 ZKF 0.80 0.81 0.82 0.81 0.83 0.82 ... 0.87 0.87 0.87 0.87 0.87 0.87 0.87 ZKFO 1.00 1.00 1.00 1.00 1.00 1.00 ... 1.02 1.02 1.02 1.02 1.02 1.02 1.02 ZX 0.00 0.00 0.00 0.00 0.00 0.00 ... 0.00 0.00 0.00 0.00 0.00 0.00 0.00 ZZF_ 0.69 0.69 0.69 0.69 0.69 0.69 ... 0.69 0.69 0.69 0.69 0.69 0.69 0.69
Methods
__init__([filepath])clear()Delete all objects from the current database.
compare(filepath[, ...])The objects of the current database are compared with those stored in the file filepath.
convert_file(input_file, input_format, ...)Convert an external file representing IODE variables to an IODE variables file (.var).
copy([pattern])Create a new Variables database in which each variable is a copy of the original variable from the global Variables workspace.
copy_from(input_files[, from_period, ...])Copy (a subset of) variables from the input file(s) 'input_files' into the current database.
execute_RAS(pattern, xdim, ydim, ref_year, ...)Execute the RAS algorithm (also called IPF for 'Iterative Proportional Fitting').
export_as_file(variables_file, rule_file, ...)Convert an IODE Variables file to a format used by some other programs.
extrapolate(method[, from_period, ...])Extrapolate variables using one the method described below, based on previous periods.
from_array(array[, time_axis_name, sep])Copies the Array array into the IODE Variables database.
from_cython_obj(obj)from_frame(df)Copy the pandas DataFrame df into the IODE Variables database.
from_numpy(data[, vars_names, first_period, ...])Copy the numpy ndarray array into the IODE Variables database.
get_instance()get_name(pos)Return the name of the IODE object at position pos in the database.
get_names([pattern, filepath])Returns the list of objects names given a pattern.
get_names_from_pattern(list_name, pattern, xdim)Generate an IODE list containing the names of objects that match a given pattern.
high_to_low(type_of_series, filepath, var_list)Build series of lower periodicity by (summing the / taking the average of the / taking the last observation of) sub-periods.
index(name)Return the position of the IODE object with name name in the database.
load(filepath)Load objects stored in file 'filepath' into the current database.
low_to_high(type_of_series, method, ...)Build series with higher periodicity for stock data (Unemployment, Debt, ...) or flow data (GNP, Deficit, ...).
merge(other[, overwrite])Merge the content of the 'other' database into the current database.
merge_from(input_file)Merge all objects stored in the input file 'input_file' into the current database.
Create a new empty detached database.
periods_subset([from_period, to_period, ...])Return a subset of the periods from the current Variables sample.
plot([names, periods, plot_type, title, ...])Plot the variables defined by names for the periods defined by periods.
print_to_file(filepath[, names, format])Print the list variables defined by names to the file filepath using the format format.
remove(names)Delete the object(s) named 'names' from the current database.
rename(old_name, new_name[, overwrite])Rename an object of the database.
save(filepath[, compress])Save objects of the current database into the file 'filepath'.
search(pattern[, word, case_sensitive, ...])Return a list of all objects from the current database having a specific pattern in their names or LEC expression, comment...
seasonal_adjustment(input_file[, eps_test, ...])Eliminate seasonal variations in monthly series (= variables).
subset(pattern, copy[, first_period, ...])Create a subset of the database filtered by a name pattern.
to_array(vars_axis_name, time_axis_name, ...)Creates an Array from the current IODE Variables database.
to_frame(vars_axis_name, time_axis_name, ...)Create a pandas DataFrame from the current Variables database.
to_numpy()Create a Numpy ndarray from the current Variables database.
trend_correction(input_file, lambda_[, ...])Implementation of the Hodrick-Prescott method for trend series (= variables) construction.
Attributes
Description of the current database.
Create a pandas DataFrame from the current Variables database.
Return the filepath associated with the current database.
first_periodFirst period of the current Variables database.
Allow to select the ith variable in the database.
Return the object type of the current database.
Whether or not any change made on the present database or subset will modify the global IODE workspace.
Whether or not the present database represents the global IODE workspace.
last_periodLast period of the current Variables database.
Current display mode for the IODE Variables values.
List of names of all objects in the current database.
Return the number of periods from the current Variables sample.
Return the list of periods from the current Variables sample.
Return the list of periods as float from the current Variables sample.
Return the list of periods as string from the current Variables sample.
Current (or new) sample of the IODE Variables database.
Threshold under which the difference between 2 variables are considered equal.