Add population stats

This commit is contained in:
heyarne 2021-02-27 09:42:02 +01:00
commit 3246ab211a
5 changed files with 66526 additions and 8 deletions

View file

@ -1,3 +1,5 @@
#+PROPERTY: header-args :results output replace
* datasette
This repository contians everything you need to deploy SQLite databases to dokku via https://datasette.io/.
@ -24,24 +26,41 @@ done
#+end_src
#+RESULTS:
*** Cumulative CO2 emissions
*** Earth
**** Cumulative CO2 emissions
Source: https://ourworldindata.org/grapher/cumulative-co-emissions
#+begin_src bash :results output replace
#+begin_src bash
csvs-to-sqlite \
--shape 'Entity:entity(text),Code:code(text),Year:year(integer),Cumulative CO2 emissions:cumulative_co2_emissions(real)' \
--extract-column entity,code \
--index entity \
--index code \
--index year \
--replace-tables \
sources/cumulative_co2_emissions.csv dbs/climate.db
sources/cumulative_co2_emissions.csv dbs/earth.db
#+end_src
#+RESULTS:
: extract_columns=('entity,code',)
: Loaded 1 dataframes
: Added 1 CSV file to dbs/climate.db
: Created dbs/earth.db from 1 CSV file
**** Population, Historic and Projected
#+begin_src bash
sed -i 's/"Population by country and region, historic and projections (Gapminder, HYDE & UN)"/Population/' sources/population.csv
csvs-to-sqlite \
--shape 'Entity:entity(text),Code:code(text),Year:year,Population:population(integer)' \
--index entity \
--index code \
--index year \
--replace-tables \
sources/population.csv dbs/earth.db
#+end_src
#+RESULTS:
: Loaded 1 dataframes
: Added 1 CSV file to dbs/earth.db
** Pitalls

Binary file not shown.

BIN
dbs/earth.db Normal file

Binary file not shown.

View file

@ -1,9 +1,22 @@
databases:
climate:
earth:
tables:
cumulative_co2_emissions:
name: "Cumulative CO2 emissions since 1850"
description: |
Cumulative carbon dioxide (CO₂) emissions represents the total sum of CO₂ emissions produced from
fossil fuels and cement since 1751, and is measured in tonnes. This measures CO₂ emissions from
fossil fuels and cement production only land use change is not included.
source: "Our World In Data"
source_url: "https://ourworldindata.org/grapher/cumulative-co-emissions"
license: "CC-BY 4.0"
units:
cumulative_co2_emissions: "tonnes"
population:
name: "Population, 1800 to 2100"
description: |
Historical estimates of population, combined with the projected population to 2100 based on the
UN's medium variant scenario.
source: "Our World In Data"
source_url: "https://ourworldindata.org/grapher/projected-population-by-country"
license: "CC-BY 4.0"

66486
sources/population.csv Normal file

File diff suppressed because it is too large Load diff