Package: mariopy
MARIOMultifunctional Analysis of Regions through Input-Output.  (Documents)What is itMARIOis a python package for handling input-output tables and models inspired byPymrio.
MARIO aims to provide asimple&intuitiveAPI 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 regionMulti regionHybrid tablesMonetary tablesInput-Output tablesSupply-Use tablesWhen 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 databasesSUT to IOT transformationModifying database in terms of adding:New sectors, activities or commodities to the databaseAdding new extensions to the satellite accountScneario and shock analysisBackward and forward linkages analysisExtracting single region database from multi region databasesBalance testProductivity testExporting the databases into different formats for scenarios analyzedInteractive visualization routinesRequirementsMARIO has been tested on macOS and Windows.To run MARIO, a couple of things are needed:Being in love with Input-Output :-)The Python programming language, version 3.7 or higherA number of Python adds-on packagesFor some functionalities a solver may needed (optional)MARIO software itselfRecommended installation methodThe easiest way to make MARIO software working is to use the free
conda package manager which can install the current and future MARIO
depencies in an easy and user friendly way.To get conda,download and install “Anaconda Distribution”. Between differnet options for running python codes, we strongly suggest,Spyder,
which is  a free and open source scientific environment written in Python, for Python, and designed by and for scientists,
engineers and data analysts.You can install mario using pip or from source code. It is suggested to create a new environment by running the following command in the anaconda promptcondacreate-nmariopython=3.8If you create a new environment for mario, to use it, you need to activate the mario environment each time by writing
the following line inAnaconda PromptcondaactivatemarioNow you can use pip to install mario on your environment as follow:pipinstallmariopyYou can also install from the source code!QuickstartA simple test for Input-Output Table (IOT) and Supply-Use Table (SUT) is included in mario.To use the IOT test, callimportmariotest_iot=mario.load_test('IOT')and to use the SUT test, calltest_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_historyThe new database can be saved into excel,txt or csv file:reformed_iot.to_excel(path='a folder//database.xlsx')Python module requirementsSome of the key packages the mario relies on are:PandasNumpyPlotlyTabulatePymrioCvxpy(Optional in this version)Testing MARIOThe 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 utilizespytestas 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=mariotests/NoteThis 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 frameworkFor more tutorials on mario, check out ourInput-Output analysis and modelling with MARIO CourseLicenseThis work is licensed under aGNU GENERAL PUBLIC LICENSE