Excel parser
Parsing IOT¶
In order to parse an input-output table thorugh excel file, the database should follows a specific format as shown in the following example
The shape of database¶
The shape of units¶
when the files are prepared, the parse_from_excel function can be used
In [1]:
from mario import parse_from_excel
In [2]:
test = parse_from_excel(
path= r'IOT.xlsx', # the path to the excel file
table= 'IOT', # type of the table
#data_sheet='flows' by default function will take the first sheet as the data, in case needed can be changed,
#unit_sheet='units' by default function will take the sheet named units
#mode= 'flows' by default function will assume flows are given in the excel. if data are coefficints, model should be changed
)
In [3]:
test
Out[3]:
name = None table = IOT scenarios = ['baseline'] Factor of production = 3 Satellite account = 4 Consumption category = 1 Region = 2 Sector = 6
Parsing SUT¶
The shape of database¶
The shape of units¶
In [4]:
# database can be parsed exactly the same way just by changing the table
test = parse_from_excel(
path= 'SUT.xlsx', # the path to the excel file
table= 'SUT', # type of the table
#data_sheet='flows' by default function will take the first sheet as the data, in case needed can be changed,
#unit_sheet='units' by default function will take the sheet named units
#mode= 'flows' by default function will assume flows are given in the excel. if data are coefficints, model should be changed
)