https://img.shields.io/gitter/room/SESAM-Polimi/MARIO https://img.shields.io/badge/code%20style-black-000000.svg Documentation Status https://badge.fury.io/py/mariopy.svg https://raw.githubusercontent.com/SESAM-Polimi/MARIO/767d2c0e9e42ae0b6acf7c3a1cc379d7bcd367fa/doc/source/_static/images/polimi.svg https://zenodo.org/badge/421900437.svg

MARIO

Multifunctional Analysis of Regions through Input-Output. (Documents)

What is it

MARIO is a python package for handling input-output tables and models inspired by Pymrio . MARIO aims to provide a simple & intuitive API for common IO tasks without needing in-depth programming knowledge. MARIO supporst automatic parsing of different structured tables such EXIOBASE, EORA, EUROSTAT in different formats namely:

  • Single region

  • Multi region

  • Hybrid tables

  • Monetary tables

  • Input-Output tables

  • Supply-Use tables

When databases are not structured, MARIO supports parsing data from xlsx, csv, txt files or pandas.DataFrames.

More than parsing data, MARIO includes some basic functionalities:

  • Aggregation of databases

  • SUT to IOT transformation

  • Modifying database in terms of adding:
    • New sectors, activities or commodities to the database

    • Adding new extensions to the satellite account

  • Scneario and shock analysis

  • Backward and forward linkages analysis

  • Extracting single region database from multi region databases

  • Balance test

  • Productivity test

  • Exporting the databases into different formats for scenarios analyzed

  • Interactive visualization routines

Requirements

MARIO has been tested on macOS and Windows.

To run MARIO, a couple of things are needed:

  1. Being in love with Input-Output :-)

  2. The Python programming language, version 3.7 or higher

  3. A number of Python adds-on packages

  4. For some functionalities a solver may needed (optional)

  5. MARIO software itself

Quickstart

A simple test for Input-Output Table (IOT) and Supply-Use Table (SUT) is included in mario.

To use the IOT test, call

import mario
test_iot = mario.load_test('IOT')

and to use the SUT test, call

test_sut = mario.load_test('SUT')

To see the configurations of the data, you can print them:

print(test_iot)
print(test_sut)

To see specific sets of the tables like regions or value added, get_index function can be used:

print(test_iot.get_index('Region'))
print(test_sut.get_index('Factor of production'))

To visualize some data, various plot functions can be used:

test_iot.plot_matrix(....)

Specific modifications on the database can be done, such as SUT to IOT transformation:

reformed_iot = test.to_iot(method='B')

The changes can be tracked by metadata. The history can be checked by calling:

reformed_iot.meta_history

The new database can be saved into excel,txt or csv file:

reformed_iot.to_excel(path='a folder//database.xlsx')

Python module requirements

Some of the key packages the mario relies on are:

Testing MARIO

The current version of Mario has achieved a test coverage of 49%. This coverage includes a comprehensive 100% assessment of the fundamental mathematical engine. Additional tests are currently in active development to enhance the package’s reliability. Mario utilizes pytest as its primary tool for conducting unit tests. For a more detailed analysis of the test coverage pertaining to mario’s unit tests, you can execute the following command:

pytest --cov=mario tests/

Note

  • This project is under active development.

  • More examples will be uploaded through time to the gellery.

  • More parsers will be added to the next version.

  • The next version will cover some optimization models within the IO framework

  • For more tutorials on mario, check out our Input-Output analysis and modelling with MARIO Course

License

https://www.gnu.org/graphics/gplv3-or-later.png

This work is licensed under a GNU GENERAL PUBLIC LICENSE