• azurecoder

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.

53 views0 comments

Recent Posts

See All

I had a great time last weekend with a garden party with my friend and one of my longstanding tech leads David. It was great to spend the afternoon with friends and work colleagues. Great food, great

I've taken the last week off. For the first time in about a decade I haven't responded to emails (at least I've picked and chosen), Teams messages (same) and I've signed out of all of my customer acco