Introduction
This notebook showcases some of the commands you can use with the ledgerdata python client
Instantiate a client object¶
In [1]:
Copied!
from ledgerdata import Client
client = Client()
from ledgerdata import Client
client = Client()
Show all actors¶
In [2]:
Copied!
client.get_all_actors()
client.get_all_actors()
Out[2]:
| id | name | type | is_part_of | |
|---|---|---|---|---|
| 0 | EARTH | Earth | planet | NaN |
| 1 | AD | Andorra | country | NaN |
| 2 | AE | United Arab Emirates | country | NaN |
| 3 | AF | Afghanistan | country | NaN |
| 4 | AG | Antigua and Barbuda | country | NaN |
| ... | ... | ... | ... | ... |
| 117902 | ZWSTH | Southerton | city | ZW |
| 117903 | ZWTHJ | Thompson Junction | city | ZW |
| 117904 | ZWVFA | Victoria Falls | city | ZW |
| 117905 | ZWZMZ | Zimbabwe | city | ZW-MV |
| 117906 | ZWZVS | Zvishavane | city | ZW-MI |
117907 rows × 4 columns
Show parts of an actor. Here I show parts of Canada¶
In [3]:
Copied!
actor_id = "CA"
client.parts_of_actor(actor_id)
actor_id = "CA"
client.parts_of_actor(actor_id)
Out[3]:
| id | name | type | is_part_of | |
|---|---|---|---|---|
| 0 | CA-AB | Alberta | adm1 | CA |
| 1 | CA-BC | British Columbia | adm1 | CA |
| 2 | CA-MB | Manitoba | adm1 | CA |
| 3 | CA-NB | New Brunswick | adm1 | CA |
| 4 | CA-NL | Newfoundland and Labrador | adm1 | CA |
| 5 | CA-NS | Nouvelle-Écosse | adm1 | CA |
| 6 | CA-NT | Northwest Territories | adm1 | CA |
| 7 | CA-NU | Nunavut | adm1 | CA |
| 8 | CA-ON | Ontario | adm1 | CA |
| 9 | CA-PE | Prince Edward Island | adm1 | CA |
| 10 | CA-QC | Quebec | adm1 | CA |
| 11 | CA-SK | Saskatchewan | adm1 | CA |
| 12 | CA-YT | Yukon | adm1 | CA |
| 13 | CABRP | Brampton | city | CA |
| 14 | CAFGS | Fergus | city | CA |
| 15 | CAKBD | Kent Bridge | city | CA |
| 16 | CAAPH | Saint-Alphonse | city | CA |
| 17 | CABOJ | Saint-Bruno-Lac-Saint-Jean | city | CA |
| 18 | CAMRT | Saint-Martin | city | CA |
| 19 | CASFH | Seaforth | city | CA |
| 20 | CAUCL | Ucluelet | city | CA |
| 21 | CAWRF | White Rose Field | city | CA |
Get all the emissions from an actor¶
In [4]:
Copied!
actor_id = "CA"
client.emissions(actor_id=actor_id)
actor_id = "CA"
client.emissions(actor_id=actor_id)
Out[4]:
| actor_id | year | emissions | units | assessment_report | |
|---|---|---|---|---|---|
| 0 | CA | 1850 | 1.099892e+07 | CO2 * tonne / yr | AR2 |
| 1 | CA | 1850 | 1.149877e+07 | CO2 * tonne / yr | AR3 |
| 2 | CA | 1850 | 1.220366e+07 | CO2 * tonne / yr | AR4 |
| 3 | CA | 1850 | 1.281027e+07 | CO2 * tonne / yr | AR5 |
| 4 | CA | 1850 | 1.287560e+07 | CO2 * tonne / yr | AR6 |
| ... | ... | ... | ... | ... | ... |
| 865 | CA | 2023 | 7.471384e+08 | CO2 * tonne / yr | AR2 |
| 866 | CA | 2023 | 7.372700e+08 | CO2 * tonne / yr | AR3 |
| 867 | CA | 2023 | 7.629434e+08 | CO2 * tonne / yr | AR4 |
| 868 | CA | 2023 | 7.687628e+08 | CO2 * tonne / yr | AR5 |
| 869 | CA | 2023 | 7.720166e+08 | CO2 * tonne / yr | AR6 |
870 rows × 5 columns
can also get contextual data¶
In [5]:
Copied!
client.gdp(actor_id)
client.gdp(actor_id)
Out[5]:
In [6]:
Copied!
client.population(actor_id)
client.population(actor_id)
Out[6]:
| actor_id | year | population | |
|---|---|---|---|
| 0 | CA | 1950 | 13741747 |
| 1 | CA | 1951 | 14083299 |
| 2 | CA | 1952 | 14482799 |
| 3 | CA | 1953 | 14897875 |
| 4 | CA | 1954 | 15318987 |
| ... | ... | ... | ... |
| 71 | CA | 2021 | 38454057 |
| 72 | CA | 2022 | 38821259 |
| 73 | CA | 2023 | 39299105 |
| 74 | CA | 2024 | 39742430 |
| 75 | CA | 2025 | 40126723 |
76 rows × 3 columns
In [7]:
Copied!
client.targets(actor_id)
client.targets(actor_id)
Out[7]:
| actor_id | target_type | baseline_year | target_year | percent_reduction | url | |
|---|---|---|---|---|---|---|
| 0 | CA | absolute_reduction | 2005 | 2030 | 40.0 | https://www.canada.ca/en/services/environment/... |
Show all datasources¶
In [8]:
Copied!
client.datasource()
client.datasource()
Out[8]:
| datasource_id | name | publisher | published_date | version | url | |
|---|---|---|---|---|---|---|
| 0 | ipregistry:iso-3166-1 | ISO-3166 data | ipregistry | 2023-11-23T00:00:00 | 2023-11-23 | https://github.com/ipregistry/iso3166 |
| 1 | United_Nations:wpp | World Population Prospects 2024 | United Nations | 2024-01-01T00:00:00 | 2024 | https://population.un.org/wpp/downloads?folder... |
| 2 | ipregistry:iso-3166-2 | ISO-3166 data | ipregistry | 2023-11-23T00:00:00 | 2023-11-23 | https://github.com/ipregistry/iso3166 |
| 3 | unece:locode | United Nations Code for Trade and Transport Lo... | unece | 2025-01-15T00:00:00 | v2024-2 | https://unece.org/trade/uncefact/unlocode |
| 4 | Australian-Bureau-of-Statistics:abs-national-s... | National, state and territory population | Australian-Bureau-of-Statistics | 2025-10-28T00:00:00 | 20251028 | https://www.abs.gov.au/statistics/people/popul... |
| ... | ... | ... | ... | ... | ... | ... |
| 65 | ECCC:official-ghg-inventory | Official Greenhouse Gas Inventory | ECCC | 2025-03-21T00:00:00 | 20250321 | https://data.ec.gc.ca/data/substances/monitor/... |
| 66 | NAEI:ghg-inventory-england-scotland-wales-nort... | Greenhouse Gas Inventories for England, Scotla... | NAEI | 2025-10-06T00:00:00 | 20251006 | https://naei.energysecurity.gov.uk/reports/gre... |
| 67 | EPA:state-ghg-emissions-and-removals | State GHG Emissions and Removals | EPA | 2024-08-29T00:00:00 | v082924 | https://www.epa.gov/ghgemissions/state-ghg-emi... |
| 68 | Climate Resource:primap | primap | Climate Resource | 2025-03-13T00:00:00 | 2.6.1 | https://zenodo.org/records/15016289 |
| 69 | DCCEEW:official-ghg-inventory | State & Territory Inventories 2023 - Emission ... | DCCEEW | 2025-05-01T00:00:00 | 20250501 | https://www.greenhouseaccounts.climatechange.g... |
70 rows × 6 columns
Show all global warming potentials¶
In [9]:
Copied!
client.gwp()
client.gwp()
Out[9]:
| gas | gwp100 | assessment_report | |
|---|---|---|---|
| 0 | CO2 | 1.0 | AR6 |
| 1 | CH4 | 27.9 | AR6 |
| 2 | CH4_nonfossil | 27.0 | AR6 |
| 3 | CH4_fossil | 29.8 | AR6 |
| 4 | N2O | 273.0 | AR6 |
| 5 | NF3 | 17400.0 | AR6 |
| 6 | SF6 | 24300.0 | AR6 |
show all sectors¶
In [10]:
Copied!
client.sector()
client.sector()
Out[10]:
| code | parent_code | name | taxonomy | description | datasource_id | |
|---|---|---|---|---|---|---|
| 0 | 1 | NaN | Energy | Common Reporting Table (CRT) | None | ipcc:crt |
| 1 | 1.A | 1 | Fuel combustion | Common Reporting Table (CRT) | None | ipcc:crt |
| 2 | 1.A.1 | 1.A | Energy industries | Common Reporting Table (CRT) | None | ipcc:crt |
| 3 | 1.A.2 | 1.A | Manufacturing industries and construction | Common Reporting Table (CRT) | None | ipcc:crt |
| 4 | 1.A.3 | 1.A | Transport | Common Reporting Table (CRT) | None | ipcc:crt |
| 5 | 1.A.4 | 1.A | Other sectors | Common Reporting Table (CRT) | None | ipcc:crt |
| 6 | 1.A.5 | 1.A | Other | Common Reporting Table (CRT) | None | ipcc:crt |
| 7 | 1.B | 1 | Fugitive emissions from fuels | Common Reporting Table (CRT) | None | ipcc:crt |
| 8 | 1.B.1 | 1.B | Solid fuels | Common Reporting Table (CRT) | None | ipcc:crt |
| 9 | 1.B.2 | 1.B | Oil and natural gas and other emissions from e... | Common Reporting Table (CRT) | None | ipcc:crt |
| 10 | 1.C | 1 | CO2 Transport and storage | Common Reporting Table (CRT) | None | ipcc:crt |
| 11 | 2 | NaN | Industrial processes and product use | Common Reporting Table (CRT) | None | ipcc:crt |
| 12 | 2.A | 2 | Mineral industry | Common Reporting Table (CRT) | None | ipcc:crt |
| 13 | 2.B | 2 | Chemical industry | Common Reporting Table (CRT) | None | ipcc:crt |
| 14 | 2.C | 2 | Metal industry | Common Reporting Table (CRT) | None | ipcc:crt |
| 15 | 2.D | 2 | Non-energy products from fuels and solvent use | Common Reporting Table (CRT) | None | ipcc:crt |
| 16 | 2.E | 2 | Electronic industry | Common Reporting Table (CRT) | None | ipcc:crt |
| 17 | 2.F | 2 | Product uses as substitutes for ODS | Common Reporting Table (CRT) | None | ipcc:crt |
| 18 | 2.G | 2 | Other product manufacture and use | Common Reporting Table (CRT) | None | ipcc:crt |
| 19 | 2.H | 2 | Other | Common Reporting Table (CRT) | None | ipcc:crt |
| 20 | 3 | NaN | Agriculture | Common Reporting Table (CRT) | None | ipcc:crt |
| 21 | 3.A | 3 | Enteric fermentation | Common Reporting Table (CRT) | None | ipcc:crt |
| 22 | 3.B | 3 | Manure management | Common Reporting Table (CRT) | None | ipcc:crt |
| 23 | 3.C | 3 | Rice cultivation | Common Reporting Table (CRT) | None | ipcc:crt |
| 24 | 3.D | 3 | Agricultural soils | Common Reporting Table (CRT) | None | ipcc:crt |
| 25 | 3.E | 3 | Prescribed burning of savannahs | Common Reporting Table (CRT) | None | ipcc:crt |
| 26 | 3.F | 3 | Field burning of agricultural residues | Common Reporting Table (CRT) | None | ipcc:crt |
| 27 | 3.G | 3 | Liming | Common Reporting Table (CRT) | None | ipcc:crt |
| 28 | 3.H | 3 | Urea application | Common Reporting Table (CRT) | None | ipcc:crt |
| 29 | 3.I | 3 | Other carbon-containing fertilizers | Common Reporting Table (CRT) | None | ipcc:crt |
| 30 | 3.J | 3 | Other | Common Reporting Table (CRT) | None | ipcc:crt |
| 31 | 4 | NaN | Land use, land-use change and forestry | Common Reporting Table (CRT) | None | ipcc:crt |
| 32 | 4.A | 4 | Forest land | Common Reporting Table (CRT) | None | ipcc:crt |
| 33 | 4.B | 4 | Cropland | Common Reporting Table (CRT) | None | ipcc:crt |
| 34 | 4.C | 4 | Grassland | Common Reporting Table (CRT) | None | ipcc:crt |
| 35 | 4.D | 4 | Wetlands | Common Reporting Table (CRT) | None | ipcc:crt |
| 36 | 4.E | 4 | Settlements | Common Reporting Table (CRT) | None | ipcc:crt |
| 37 | 4.F | 4 | Other land | Common Reporting Table (CRT) | None | ipcc:crt |
| 38 | 4.G | 4 | Harvested wood products | Common Reporting Table (CRT) | None | ipcc:crt |
| 39 | 4.H | 4 | Other | Common Reporting Table (CRT) | None | ipcc:crt |
| 40 | 5 | NaN | Waste | Common Reporting Table (CRT) | None | ipcc:crt |
| 41 | 5.A | 5 | Solid waste disposal | Common Reporting Table (CRT) | None | ipcc:crt |
| 42 | 5.B | 5 | Biological treatment of solid waste | Common Reporting Table (CRT) | None | ipcc:crt |
| 43 | 5.C | 5 | Incineration and open burning of waste | Common Reporting Table (CRT) | None | ipcc:crt |
| 44 | 5.D | 5 | Wastewater treatment and discharge | Common Reporting Table (CRT) | None | ipcc:crt |
| 45 | 5.E | 5 | Other | Common Reporting Table (CRT) | None | ipcc:crt |
| 46 | 6 | NaN | Other | Common Reporting Table (CRT) | None | ipcc:crt |
| 47 | 1.D.1 | 1.D | International bunkers | Common Reporting Table (CRT) | None | ipcc:crt |
| 48 | 1.D.1.a | 1.D.1 | Aviation | Common Reporting Table (CRT) | None | ipcc:crt |
| 49 | 1.D.1.b | 1.D.1 | Navigation | Common Reporting Table (CRT) | None | ipcc:crt |
| 50 | 1.D.2 | 1.D | Multilateral operations | Common Reporting Table (CRT) | None | ipcc:crt |
| 51 | 1.D.3 | 1.D | CO2 emissions from biomass | Common Reporting Table (CRT) | None | ipcc:crt |
| 52 | 1.D.4 | 1.D | CO2 captured | Common Reporting Table (CRT) | None | ipcc:crt |
| 53 | 5.F.1 | 5.F | Long-term storage of C in waste disposal sites | Common Reporting Table (CRT) | None | ipcc:crt |