top of page
  • Writer's pictureazurecoder

Open Source solution for input output tables

So input output tables are an economic cludge format which groups together a bunch of coefficients per country per year (these are specifically country tables) so that you can work out relative inputs and exports of a country.

Last weekend I helped run a hackathon on sustainable finance. We had some great entries and some very smart approaches to bundling transition risk into credit risk.

We got sponsored data by a group called Eora which gave us a set of input-output tables. For my first pass I tried to use pymrio to read them but it I didn't find it that easy so I thought I'd right my own parser which our team might be able to use much easier.

I'm a bit of a hacky Python programmer but all the data scientists in my team would it need it in Python so I thought I'd take advantage of some of the Python 3 features and be more OO in my approach This is what it ended up looking like.

if __name__ == "__main__":    
    filepath_1 = sys.argv[1]
    filepath_2 = sys.argv[2]
    table1 = CountryTable(CountryTableSegment.PrimaryInputs, filepath_1)
    table2 = CountryTable(CountryTableSegment.PrimaryInputs, filepath_2)
    df = table2.append(table1)

And returning Pandas DataFrames. Going to make a few updates so that it reads directories and also reads each of the other parts of the country table as well.

You can learning a little about the solution here and check out the code. Trying to finish it within the next few weeks and add to pypi.

Interested and economist please feel free to get in touch.

92 views0 comments

Recent Posts

See All

The new new normal

Well the number of people looking for work in the cloud and data sector has now shot up as everyone adjusts their forecast expectations and hangs onto their cash like the analysts have been saying. It


bottom of page