euromod.core¶
Below are listed the main public classes of the euromod.core module.
- |
|
- |
|
Country-specific EUROMOD tax-benefit model. |
|
Dataset available in a country model. |
|
Datasets available in a system model. |
|
EUROMOD extensions. |
|
A class containing the extension switches of an object. |
|
Functions implemented in a country policy. |
|
Functions implemented in a policy for a specific system. |
|
Container class storing Country objects. |
|
Base class of the Euromod Connector instantiating the microsimulation model |
|
Parameters set up in a function. |
|
Parameters set up in a function for a specific system. |
|
Policy rules modeled in a country. |
|
Policy rules modeled in a system. |
|
Object storing the reference policies. |
|
Object storing the simulation results. |
|
A EUROMOD tax-benefit system. |
|
- |
|
- |
|
Container class storing Country objects. |
- class euromod.core.ConsumptionTaxFactor(*args)¶
Overview
Attributes¶ Identifier for ConsumptionTaxFactor
COICOP code related to consumption tax
Combined COICOP code and version
Label for the COICOP code
Version of the COICOP code
Comment regarding the consumption tax factor
Name of the consumption tax factor
ITT Name of the consumption tax factor
Parameter type, e.g., VAT Rates
-
Unit of the consumption tax factor, e.g., percentage
Container for the consumption tax values for respective years
Attributes
- values: IndTaxInfoContainer¶
Container for the consumption tax values for respective years
- class euromod.core.ConsumptionTaxFactorYear(*args)¶
Overview
Attributes¶ Identifier for the individual tax in this year
-
Tax factor value for the specified year
Year associated with this tax factor
Attributes
- parent: ConsumptionTaxFactor¶
- class euromod.core.Country(country: str, model: Model)¶
Country-specific EUROMOD tax-benefit model.
This class instantiates the EUROMOD tax benefit model for a given country. A class instance is automatically generated and stored in the attribute
countriesof the base classModel.This class contains subclasses of type
System,Policy,DatasetandExtension.- Parameters:
country (
str) – Name of the country. Must be a two-letter country codes, see the Eurostat Glossary:Country codes.model (
Model) – A class containing the EUROMOD base model.
- Returns:
A class containing the EUROMOD country models.
- Return type:
Example
>>> from euromod import Model >>> mod=Model("C:\EUROMOD_RELEASES_I6.0+") >>> mod.countries[0]
Overview
Attributes¶ A
ContainerwithConsumptionTaxFactorobjects.A
ContainerwithDatasetobjects.A
ContainerwithExtensionobjects. These are the local + model extensions defined.A
ContainerwithExtensionobjects. These are the local extensions defined for the country.Two-letters country code.
A
ContainerwithPolicyobjects.A
ContainerwithSystemobjects.A
ContainerwithUprateFactorobjects.Methods¶ get_switch_value(ext_name, dataset_name, sys_name)Get the configuration of the switch.
load_data(ID_DATASET, PATH_DATA)Load data as a
pandas.DataFrameobject.Attributes
- ct_factors: container.Container[ConsumptionTaxFactor] | None = None¶
A
ContainerwithConsumptionTaxFactorobjects.
- datasets: container.Container[Dataset] | None = None¶
A
ContainerwithDatasetobjects.
- extensions: container.Container[Extension] | None = None¶
A
ContainerwithExtensionobjects. These are the local + model extensions defined.
- local_extensions: container.Container[Extension] | None = None¶
A
ContainerwithExtensionobjects. These are the local extensions defined for the country.
- policies: container.Container[Policy] | None = None¶
A
ContainerwithPolicyobjects.
- systems: container.Container[System] | None = None¶
A
ContainerwithSystemobjects.
- upratefactors: container.Container[UprateFactor] | None = None¶
A
ContainerwithUprateFactorobjects.
Methods
- get_switch_value(ext_name: str | None = None, dataset_name: str | None = None, sys_name: str | None = None)¶
Get the configuration of the switch.
- Parameters:
- Raises:
KeyError – Is raised if ext_name, dataset_name or sys_name, but is not configured in the model.
- Returns:
Object containing information how the switch is configured. Note that there is only a value returned if the switch is either explicitly ‘off’ or ‘on’. When it’s configured as n/a in the model no value will be included.
- Return type:
- load_data(ID_DATASET, PATH_DATA=None)¶
Load data as a
pandas.DataFrameobject.- Parameters:
- Returns:
Dataset is returned as a
pandas.DataFrameobject.- Return type:
- class euromod.core.Dataset(*args)¶
Dataset available in a country model.
This class contains the relevant information about a dataset.
- Returns:
A class with the country-specific dataset.
- Return type:
Overview
Attributes¶ Dataset identifier number.
COICOP version.
Comment about the dataset.
Currency of the monetary values in the dataset.
Decimal sign
Name of the dataset.
The country-specific class.
Access type.
Read variables.
-
Use default.
Year of the dataset collection.
Reference year for the income variables.
Attributes
- system_elements: container.Container¶
- class euromod.core.DatasetInSystem¶
Datasets available in a system model.
- Returns:
A class with the system-specific dataset.
- Return type:
Overview
Attributes¶ Dataset identifier number.
If yes, the current dataset is a best match for the specific system.
COICOP version.
Comment about the dataset.
Currency of the monetary values in the dataset.
Identifier number of the reference dataset at the country level.
Decimal sign
Name of the dataset.
The country specific class.
Access type.
Read variables.
Identifier number of the reference system.
Use default.
Year of the dataset collection.
Reference year for the income variables.
Attributes
- class euromod.core.Extension(*arg)¶
EUROMOD extensions.
- Returns:
A class with the model extensions.
- Return type:
Overview
Attributes¶ Long name of the extension.
The model base class.
Short name of the extension.
Attributes
- class euromod.core.ExtensionSwitch(info, ctry)¶
A class containing the extension switches of an object.
This class is returned by
get_switch_value()method and should not be used by the user as a stand alone.- Returns:
A class with relevant information on the extension switch.
- Return type:
Overview
Attributes¶ Name of the applicable dataset.
Short name of the extension.
The country-specific class.
Name of the applicable system.
Value of the switch as configured in EUROOMOD.
Attributes
- class euromod.core.Function(*arg)¶
Functions implemented in a country policy.
- Returns:
A class with country-specific function.
- Return type:
Overview
Attributes¶ Identifier number of the function.
Comment specific to the function.
A
ContainerofExtensionobjects in a country.Name of the function.
Order of the function in the specific spine.
A
ContainerofParameterobjects in a country.The class of the country-specific policy.
Identifier number of the reference policy.
Access type.
Order of the function in the spine.
Attributes
- extensions: container.Container[Extension] | None = None¶
A
ContainerofExtensionobjects in a country.
- parameters: container.Container[Parameter] | None = None¶
A
ContainerofParameterobjects in a country.
- class euromod.core.FunctionInSystem(*arg)¶
Functions implemented in a policy for a specific system.
- Returns:
A class with the system-specific function.
- Return type:
Overview
Attributes¶ Identifier number of the function.
Comment specific to the function.
A
ContainerofExtensionobjects in a system.Identifier number of the reference function at country level.
Name of the function.
Order of the function in the specific spine.
A
ContainerwithParameterInSystemobjects specific to a function.The class of the country-specific policy.
Identifier number of the reference policy.
Access type.
Order of the function in the spine.
Policy switch action.
Identifier number of the reference policy.
Attributes
- extensions: container.Container[Extension]¶
A
ContainerofExtensionobjects in a system.
- parameters: container.Container[ParameterInSystem] | None = None¶
A
ContainerwithParameterInSystemobjects specific to a function.
- class euromod.core.IndTaxInfoContainer¶
Container class storing Country objects.
- class euromod.core.Model(model_path: str)¶
Base class of the Euromod Connector instantiating the microsimulation model EUROMOD.
- Parameters:
model_path (
str) – Path to the EUROMOD project.- Returns:
A class containing the EUROMOD base model.
- Return type:
Example
>>> from euromod import Model >>> mod=Model("C:\EUROMOD_RELEASES_I6.0+")
Overview
Attributes¶ A
ContainerwithCountryobjects.A
ContainerwithModelextensions.Path to the EUROMOD project.
Attributes
- countries: container.Container[Country]¶
A
ContainerwithCountryobjects.
- extensions: container.Container[Extension]¶
A
ContainerwithModelextensions.
- class euromod.core.Parameter(*arg)¶
Parameters set up in a function.
- Returns:
A class with country-specific parameter.
- Return type:
Overview
Attributes¶ Identifier number of the parameter.
Comment specific to the parameter.
A
ContainerwithExtensionobjects.Identifier number of the reference function at country level.
Parameter group value.
Name of the parameter.
Order of the parameter in the specific spine.
The class of the country-specific function.
Order of the parameter in the spine.
Attributes
- extensions: container.Container[Extension] | None = None¶
A
ContainerwithExtensionobjects.
- class euromod.core.ParameterInSystem¶
Parameters set up in a function for a specific system.
- Returns:
A class with the system-specific function parameter.
- Return type:
Overview
Attributes¶ Identifier number of the parameter.
Comment specific to the parameter.
A
ContainerwithExtensionobjects.Identifier number of the reference function at country level.
Parameter group number.
Name of the parameter.
Order of the parameter in the specific spine.
Identifier number of the reference parameter at country level.
The class of the country-specific function.
Order of the parameter in the spine.
Identifier number of the reference system.
Value of the parameter.
Attributes
- extensions: container.Container¶
A
ContainerwithExtensionobjects.
Methods
- evaluate(var_dict=dict())¶
- class euromod.core.Policy(*arg)¶
Policy rules modeled in a country.
- Returns:
A class with the country-specific policies.
- Return type:
Overview
Attributes¶ Identifier number of the policy.
Comment specific to the policy.
A
Containerof policy-specificExtensionobjects.A
Containerof policy-specificFunctionobjects.Name of the policy.
Order of the policy in the specific spine.
The country-specific class.
Access type. Default is ‘no’.
Order of the policy in the spine.
Attributes
- extensions: container.Container[Extension] | None = None¶
A
Containerof policy-specificExtensionobjects.
- functions: container.Container[Function] | None = None¶
A
Containerof policy-specificFunctionobjects.
- class euromod.core.PolicyInSystem(*arg)¶
Policy rules modeled in a system.
- Returns:
A class with system-specific policies.
- Return type:
Overview
Attributes¶ Identifier number of the policy.
Comment specific to the policy.
A
Containerof policy-specificExtensionobjects.A
ContainerwithFunctionInSystemobjects specific to the systemName of the policy.
Order of the policy in the specific spine.
The country-specific class.
Identifier number of the reference policy at country level.
Access type. Default is ‘no’.
Order of the policy in the spine.
Policy switch action.
Identifier number of the reference system.
Attributes
- extensions: container.Container[Extension]¶
A
Containerof policy-specificExtensionobjects.
- functions: container.Container[FunctionInSystem] | None = None¶
A
ContainerwithFunctionInSystemobjects specific to the system
- class euromod.core.ReferencePolicy(info, parent)¶
Object storing the reference policies.
- Returns:
A class with the country-specific reference policies.
- Return type:
Overview
Attributes¶ A
Containerof reference policy-specificExtensionobjects.Name of the reference policy.
The country-specific class.
Attributes
- extensions: container.Container[Extension] | None = None¶
A
Containerof reference policy-specificExtensionobjects.
- class euromod.core.Simulation(out, constantsToOverwrite, polars)¶
Object storing the simulation results.
This is a class containing results from the simulation
run()and other related configuration information.- Returns:
A class with simulation output.
- Return type:
Overview
Attributes¶ A
dict-type object with user-defined constants.A
listwith errors and warnings from the simulation run.A
listof file-names of simulation output.A
Containerwithpandas.DataFrame-type simulation results.Attributes
- outputs: container.Container[pandas.DataFrame]¶
A
Containerwithpandas.DataFrame-type simulation results. For indexing use an integer or a label fromoutput_filenames.
- class euromod.core.System(*arg)¶
A EUROMOD tax-benefit system.
This class represents a EUROMOD tax system. Instances of this class are generated when loading the EUROMOD base model. These are collected in a
Containeras attribute systems of theCountry.- Returns:
A class with country systems.
- Return type:
Example
>>> from euromod import Model >>> mod=Model("C:\EUROMOD_RELEASES_I6.0+") >>> mod.countries[0].systems[-1]
Overview
Attributes¶ Identifier number of the system.
A
Containerwith best-matchDatasetobjects in the system.Comment specific to the system.
Currency of the simulation results.
Currency of the monetary parameters in the system.
A
ContainerofDatasetInSystemobjects in the system.Main income definition.
Name of the system.
System order in the spine.
The country-specific class.
A
ContainerofPolicyInSystemobjects in the system.Access type.
System year.
Methods¶ get_default_extensions(dataset)- param dataset:
Name of Dataset.
run(data, dataset_id, constantsToOverwrite, verbose, outputpath, addons, switches, nowarnings, euro, public_components_only, requested_vars, requested_incomelists, requested_vargroups, requested_ilgroups, suppress_other_output, breakfun_id)Run the simulation of a EUROMOD tax-benefit system by passing the pandas or polars dataframe in memory to EUROMOD. Note that string variables will not be passed.
Attributes
- bestmatch_datasets: container.Container[Dataset] | None = None¶
A
Containerwith best-matchDatasetobjects in the system.
- datasets: container.Container[DatasetInSystem] | None = None¶
A
ContainerofDatasetInSystemobjects in the system.
- policies: container.Container[PolicyInSystem] | None = None¶
A
ContainerofPolicyInSystemobjects in the system.
Methods
- get_default_extensions(dataset)¶
- run(data: pandas.DataFrame, dataset_id: str, constantsToOverwrite: Dict[Tuple[str, str], str] | None = None, verbose: bool = True, outputpath: str = '', addons: List[Tuple[str, str]] = [], switches: List[Tuple[str, bool]] = [], nowarnings=False, euro=False, public_components_only=False, requested_vars: List[str] = [], requested_incomelists: List[str] = [], requested_vargroups: List[str] = [], requested_ilgroups: List[str] = [], suppress_other_output: bool = False, breakfun_id: str = None) Simulation¶
Run the simulation of a EUROMOD tax-benefit system by passing the pandas or polars dataframe in memory to EUROMOD. Note that string variables will not be passed.
- Parameters:
data (
pandas.DataFrame) – input dataframe passed to the EUROMOD model.dataset_id (
str) – ID of the dataset.constantsToOverwrite (
dict[tuple[str,str],str], optional) – Adictwith constants to overwrite. Note that the key is a tuple of two strings, for which the first element is the name of the constant and the second is the groupnumber. Note that the values must be defined as strings. Default isNone.verbose (
bool, optional) – If True then information on the output will be printed. Default isTrue.outputpath (
str, optional) – When the output path is provided, there will be anoutput file generated. Default is “”.addons (
list[tuple[str,str]], optional) – List of tuples with addons to be integrated in the spine. The first element of the tuple is the name of the addon and the second element is the name of the system in the Addon to be integrated. Default is [].switches (
list[tuple[str,bool]], optional) – List of tuples with extensions to be switched on or of. The first element of the tuple is the short name of the extension. The second element is a boolean Default is [].nowarnings (bool, optional) – If True, the warning messages resulting from the simulations will be suppressed. Default is
False.euro (
bool, optional) – If True, the monetary variables will be converted to euro for the simulation. Default value isFalse.public_compoments_only (
bool, optional) – If True, the the model will be on with only the public compoments. Default value isFalse.nowarnings – If True then warnings returned by the model do not get printed. The default is False.
requested_vars (List[str], optional) – Variables requested in a new separate output. The default is [].
requested_incomelists (List[str], optional) – Income lists requested in a new separate output. The default is [].
requested_vargroups (List[str], optional) – Vargroups requested in a new separate output. The default is [].
requested_ilgroups (List[str], optional) – ilgroups requested in a new separate output. The default is [].
suppress_other_output (bool, optional) – If True and custom output is specified then DefOutput from the model get suppressed. The default is False.
- Raises:
Exception – Exception when simulation does not finish succesfully, i.e. without errors.
- Returns:
A class containing simulation output and error messages.
- Return type:
Example
>>> # Load the dataset >>> import pandas as pd >>> data = pd.read_csv("C:\EUROMOD_RELEASES_I6.0+\Input\sl_demo_v4.txt",sep=" ") >>> # Load EUROMOD >>> from euromod import Model >>> mod=Model("C:\EUROMOD_RELEASES_I6.0+") >>> # Run simulation >>> out=mod.countries['SL'].systems['SL_1996'].run(data,'sl_demo_v4')
- class euromod.core.UprateFactor(*args)¶
Overview
Attributes¶ Identifier UprateFactor
Comment of uprating factor
Description of uprating factor
Name of uprating factor
-
Container of the uprating values for the respective years
Attributes
- values: UprateFactorYearsContainer¶
Container of the uprating values for the respective years
- class euromod.core.UprateFactorYear(*args)¶
Overview
Attributes¶ Identifier UprateFactor
-
Value of uprating factor
Year of uprating factor
Attributes
- parent: UprateFactor¶
- class euromod.core.UprateFactorYearsContainer¶
Container class storing Country objects.