Skip to content

Commit 2ee5767

Browse files
committed
Ready to record
1 parent 4bfaecc commit 2ee5767

File tree

1 file changed

+110
-0
lines changed

1 file changed

+110
-0
lines changed

ch10-covid19/10_01_overview.ipynb

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"id": "7942c7f7-a477-49dc-ab1b-19ed3a385f63",
6+
"metadata": {},
7+
"source": [
8+
"# 10_01: COVID-19 data"
9+
]
10+
},
11+
{
12+
"cell_type": "code",
13+
"execution_count": null,
14+
"id": "87406632-413a-4fa7-9367-9e5fbd23b25b",
15+
"metadata": {},
16+
"outputs": [],
17+
"source": [
18+
"import math\n",
19+
"import collections\n",
20+
"import dataclasses\n",
21+
"import datetime\n",
22+
"\n",
23+
"import numpy as np\n",
24+
"import pandas as pd\n",
25+
"\n",
26+
"import plotly.express as px"
27+
]
28+
},
29+
{
30+
"cell_type": "code",
31+
"execution_count": null,
32+
"id": "9a002aaa-d18a-4b0f-8a56-fae318e88305",
33+
"metadata": {},
34+
"outputs": [],
35+
"source": [
36+
"covid19 = pd.read_csv('covid19.csv.gz', dtype_backend='pyarrow', parse_dates=['date'])"
37+
]
38+
},
39+
{
40+
"cell_type": "code",
41+
"execution_count": null,
42+
"id": "43c89599-3089-4709-80c0-27964a578b8c",
43+
"metadata": {},
44+
"outputs": [],
45+
"source": [
46+
"covid19.info()"
47+
]
48+
},
49+
{
50+
"cell_type": "code",
51+
"execution_count": null,
52+
"id": "3bdde2c2-0aa3-4801-9bec-14c62c7ecbe0",
53+
"metadata": {},
54+
"outputs": [],
55+
"source": [
56+
"europe2020 = covid19[(covid19.continent == 'Europe') & (covid19.date == pd.to_datetime('2020-12-31'))]"
57+
]
58+
},
59+
{
60+
"cell_type": "code",
61+
"execution_count": null,
62+
"id": "b544bae3-ac59-4577-a60c-b6a94688d017",
63+
"metadata": {},
64+
"outputs": [],
65+
"source": [
66+
"europe2020.head()"
67+
]
68+
},
69+
{
70+
"cell_type": "code",
71+
"execution_count": null,
72+
"id": "021ea340-b147-4b74-baf0-f698e604592e",
73+
"metadata": {},
74+
"outputs": [],
75+
"source": [
76+
"fig = px.choropleth(europe2020, # dataset\n",
77+
" color='total_deaths', color_continuous_scale=px.colors.sequential.Blues, # color scheme\n",
78+
" locations='country', locationmode='country names', # geographic arrangement\n",
79+
" hover_name='country', title='COVID-19 in Europe, Dec 31 2020') # titles\n",
80+
"\n",
81+
"fig.update_layout(width=800, height=500) # set figure size\n",
82+
"fig.update_geos(lonaxis={'range': [-25, 50]}, # set longitude range\n",
83+
" lataxis={'range': [30, 70]}) # set latitude range\n",
84+
"\n",
85+
"fig.show()"
86+
]
87+
}
88+
],
89+
"metadata": {
90+
"kernelspec": {
91+
"display_name": "Python 3 (ipykernel)",
92+
"language": "python",
93+
"name": "python3"
94+
},
95+
"language_info": {
96+
"codemirror_mode": {
97+
"name": "ipython",
98+
"version": 3
99+
},
100+
"file_extension": ".py",
101+
"mimetype": "text/x-python",
102+
"name": "python",
103+
"nbconvert_exporter": "python",
104+
"pygments_lexer": "ipython3",
105+
"version": "3.12.2"
106+
}
107+
},
108+
"nbformat": 4,
109+
"nbformat_minor": 5
110+
}

0 commit comments

Comments
 (0)