#!/usr/bin/env python # coding: utf-8 # # Doha Amendment to the Kyoto Protocol # In[1]: from pandas_datapackage_reader import read_datapackage # In[2]: da = read_datapackage("https://github.com/openclimatedata/doha-amendment-entry-into-force") # In[3]: da.head() # # Paris Agreement # In[4]: pa = read_datapackage("https://github.com/openclimatedata/paris-agreement-entry-into-force") # In[5]: pa.head() # ### Combination of the two datasets # In[6]: combined = pa.reset_index().merge(da.reset_index(), how="outer").set_index('Code') combined = combined.rename(columns={ "Acceptance": "Doha", "Ratification-Acceptance-Approval": "Paris" }) combined = combined[["Doha", "Paris"]].dropna(how="all") combined = combined.join(pa.Name, how="left")[["Name", "Doha", "Paris"]] # In[7]: combined.count() # #### Parties who so far ony accepted the Doha Amendment # In[8]: only_doha = combined[combined.Paris.isnull()] only_doha # #### Parties who so far ony accepted the Paris Agreement # In[9]: only_paris = combined[combined.Doha.isnull()] only_paris # #### Parties who ratified the Paris Agreement and Doha Amendment # In[10]: both = combined[~combined.Paris.isnull() & ~combined.Doha.isnull()] both # In[11]: print("Doha only: {}\nParis only: {}\nBoth Doha and Paris: {}".format(len(only_doha), len(only_paris), len(both))) # In[ ]: