Adding data, update README

This commit is contained in:
mishavelthuis 2024-08-12 15:25:37 -05:00
parent cbbea24728
commit c650c0fb66
3 changed files with 46535 additions and 5 deletions

View file

@ -1,3 +1,10 @@
* Test * Introduction
test12 This repository is described in [[https://mishathings.org/2024-08-12-how-much-co2-has-been-emitted-in-my-lifetime.html][this]] blog post.
You can find here:
- A Jupyter Notebook that produces the graph I describe in the post.
- A html export of that notebook.
- The data that the code works with (although it also allows for the fetching of data online)
- The code that runs on my VPS, which produces this interactive graph: http://mishathings.org:8050/

View file

@ -6,11 +6,10 @@ import dash_core_components as dcc
import dash_html_components as html import dash_html_components as html
from dash.dependencies import Input, Output from dash.dependencies import Input, Output
# The code below fetches the data from the "Our World in Data" Github page. # The code below fetches the data from the "Our World in Data" Github page.
# This is the data behind this graph/table: https://ourworldindata.org/grapher/cumulative-co-emissions # This is the data behind this graph/table: https://ourworldindata.org/grapher/cumulative-co-emissions
# If the url does not work you can also use the data provided, by uncommenting the line below. # If the url does not work you can also use the data provided, by uncommenting the line below.
df = pd.read_csv('/home/misha/Nextcloud/scripts_misha/klad/data/owid-co2-data.csv', header =0) df = pd.read_csv('owid-co2-data.csv', header =0)
# df = pd.read_csv('https://nyc3.digitaloceanspaces.com/owid-public/data/co2/owid-co2-data.csv', header=0) # df = pd.read_csv('https://nyc3.digitaloceanspaces.com/owid-public/data/co2/owid-co2-data.csv', header=0)
# Select only data for World # Select only data for World
@ -94,7 +93,7 @@ def update_graph(year_born):
name = '') name = '')
]) ])
subtitle= "See: <a href=\"https://git.pub.solar/misha/share_CO2_generation\">https://git.pub.solar/misha/share_CO2_generation</a> (original from <a href=\"https://x.com/neilrkaye/status/1365247133507604486\">https://x.com/neilrkaye/status/1365247133507604486</a>)" subtitle= "See: <a href=\"https://git.pub.solar/misha/CO2-generation\">https://git.pub.solar/misha/CO2-generation</a> (original from <a href=\"https://x.com/neilrkaye/status/1365247133507604486\">https://x.com/neilrkaye/status/1365247133507604486</a>)"
explainer = "If you were born in %s, %s%% of<br>the total amount of CO2 that has <br>been emitted since 1750, has been<br>emitted in your lifetime." % (int(df['year'].iloc[year_born_index].item()), int(df['share_gen'].iloc[year_born_index].item())) explainer = "If you were born in %s, %s%% of<br>the total amount of CO2 that has <br>been emitted since 1750, has been<br>emitted in your lifetime." % (int(df['year'].iloc[year_born_index].item()), int(df['share_gen'].iloc[year_born_index].item()))
(int(df['year'].iloc[year_born_index].item()), int(df['share_gen'].iloc[year_born_index].item())) (int(df['year'].iloc[year_born_index].item()), int(df['share_gen'].iloc[year_born_index].item()))

46524
owid-co2-data.csv Normal file

File diff suppressed because it is too large Load diff