mario.Database.query

Database.query(matrices, scenarios=['baseline'], base_scenario=None, type='absolute')

Requests a specific data from the database

Parameters
  • matrices (str) – list of the matrices to return

  • scenarios (str, List[str]) – list of scenarios for returing the matrices

  • base_scenario (str) – str representing the base scenario in case that the data should be returned for the change in data between scenarios

  • type (str) –

    1. ‘absolute’ for absolute difference for scenarios

    2. ’relative’ for relative difference for scenarios

Returns

If multiple scenarios are passed, it returns a dict where keys are the scenarios and vals are the matrices. matrices itself could be a dict or pd.DataFrame depending if multiple matrices or one matrix is passed

Return type

dict,pd.DataFrame

Example

Let’s consider the case that multiple scenarios [‘sc.1’,’sc.2’] and multiple matrices [‘X’,’z’] are passed:

output = example.query(scenarios= ['sc.1','sc.2'], matrices = ['X','z'])

the output in this case would be:

type: Dict[Dict[pd.DataFrame]]

{
“sc.1”{

“X”: pd.DataFrame, “z”: pd.DataFrame,

}, “sc.2” : {

“X”: pd.DataFrame, “z”: pd.DataFrame,

},

}

if only one scenario (“sc.1”) is passed, output will be:

type Dict[pd.DataFrame] {

“X”: pd.DataFrame, “Y”: pd.DataFrame,

}

if only one scenario (“sc.1”) and one matrix (“X”) is passed the output will be a single pd.DataFrame.