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