mario.slicer

mario.slicer(matrix, axis, **levels)

Helps to slice the matrices

Parameters:
  • matrix (str) – the matrix to be sliced

  • axis (int) – 0 for rows and 1 for columns

  • levels (Dict['list']) – defines the level to be sliced (according to index and columns names). for 3 level data [Region,Level,Item] and for 1 level data only [Item].

Return type:

tuple, list

Example

For slicing a the final demand matrix for reg1 and sec1 on the rows and reg1 on the columns (local final demand of sec1 of reg1):

Y_rows = slicer(matrix= 'Y', axis= 0, Region= ['reg1'], Item= ['sec1'])
Y_cols = slicer(matrix= 'Y', axis= 1, Region= ['reg1'])

# To use the slicer
data.Y.loc[Y_rows,Y_cols]