Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
AllenDowney
GitHub Repository: AllenDowney/ModSimPy
Path: blob/master/examples/population.ipynb
921 views
Kernel: Python 3 (ipykernel)

One Queue or Two

# download modsim.py if necessary from os.path import basename, exists def download(url): filename = basename(url) if not exists(filename): from urllib.request import urlretrieve local, _ = urlretrieve(url, filename) print('Downloaded ' + local) download('https://raw.githubusercontent.com/AllenDowney/' + 'ModSimPy/master/data/World_population_estimates.html')
%load_ext nb_black
import pandas as pd import requests # Fetch the data. df = pd.read_csv("https://ourworldindata.org/grapher/population.csv?v=1&csvType=filtered&useColumnShortNames=true&time=1700..latest&country=~OWID_WRL", storage_options = {'User-Agent': 'Our World In Data data fetch/1.0'}) # Fetch the metadata metadata = requests.get("https://ourworldindata.org/grapher/population.metadata.json?v=1&csvType=filtered&useColumnShortNames=true&time=1700..latest&country=~OWID_WRL").json()
table2.loc[1950:1980].plot()

Modeling and Simulation in Python

Copyright 2021 Allen Downey

License: Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International