Skip to content

Commit d670b98

Browse files
committed
fix data viz notebook
1 parent edac4ee commit d670b98

File tree

4 files changed

+43
-55
lines changed

4 files changed

+43
-55
lines changed

days/82-84-dataviz-plotly/data-viz.ipynb

Lines changed: 43 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
},
2828
{
2929
"cell_type": "code",
30-
"execution_count": 13,
30+
"execution_count": 3,
3131
"metadata": {},
3232
"outputs": [],
3333
"source": [
@@ -49,7 +49,7 @@
4949
},
5050
{
5151
"cell_type": "code",
52-
"execution_count": 3,
52+
"execution_count": 4,
5353
"metadata": {},
5454
"outputs": [
5555
{
@@ -119,7 +119,7 @@
119119
},
120120
{
121121
"cell_type": "code",
122-
"execution_count": 44,
122+
"execution_count": 9,
123123
"metadata": {},
124124
"outputs": [
125125
{
@@ -128,7 +128,7 @@
128128
"'2018-1'"
129129
]
130130
},
131-
"execution_count": 44,
131+
"execution_count": 9,
132132
"metadata": {},
133133
"output_type": "execute_result"
134134
}
@@ -140,13 +140,13 @@
140140
" dt = datetime.strptime(date_str, '%a, %d %b %Y %H:%M:%S')\n",
141141
" return f'{dt.year}-{dt.month}'\n",
142142
" \n",
143-
"yymm = convert_to_datetime('Sun, 07 Jan 2018 12:00:00 +0100')\n",
143+
"yymm = get_year_month('Sun, 07 Jan 2018 12:00:00 +0100')\n",
144144
"yymm"
145145
]
146146
},
147147
{
148148
"cell_type": "code",
149-
"execution_count": 18,
149+
"execution_count": 10,
150150
"metadata": {},
151151
"outputs": [],
152152
"source": [
@@ -176,7 +176,7 @@
176176
},
177177
{
178178
"cell_type": "code",
179-
"execution_count": 21,
179+
"execution_count": 11,
180180
"metadata": {},
181181
"outputs": [
182182
{
@@ -198,7 +198,7 @@
198198
" '2018-1': 3})"
199199
]
200200
},
201-
"execution_count": 21,
201+
"execution_count": 11,
202202
"metadata": {},
203203
"output_type": "execute_result"
204204
}
@@ -211,7 +211,7 @@
211211
},
212212
{
213213
"cell_type": "code",
214-
"execution_count": 23,
214+
"execution_count": 12,
215215
"metadata": {},
216216
"outputs": [
217217
{
@@ -224,7 +224,7 @@
224224
" ('guest', 5)]"
225225
]
226226
},
227-
"execution_count": 23,
227+
"execution_count": 12,
228228
"metadata": {},
229229
"output_type": "execute_result"
230230
}
@@ -238,7 +238,7 @@
238238
},
239239
{
240240
"cell_type": "code",
241-
"execution_count": 24,
241+
"execution_count": 13,
242242
"metadata": {},
243243
"outputs": [
244244
{
@@ -251,7 +251,7 @@
251251
" ('tips', 65)]"
252252
]
253253
},
254-
"execution_count": 24,
254+
"execution_count": 13,
255255
"metadata": {},
256256
"output_type": "execute_result"
257257
}
@@ -288,7 +288,7 @@
288288
},
289289
{
290290
"cell_type": "code",
291-
"execution_count": 31,
291+
"execution_count": 14,
292292
"metadata": {},
293293
"outputs": [
294294
{
@@ -311,7 +311,7 @@
311311
" (3, 11, 12, 13, 13, 19, 23, 19, 22, 23, 25, 20, 27, 13)]"
312312
]
313313
},
314-
"execution_count": 31,
314+
"execution_count": 14,
315315
"metadata": {},
316316
"output_type": "execute_result"
317317
}
@@ -336,30 +336,15 @@
336336
]
337337
},
338338
{
339-
"cell_type": "code",
340-
"execution_count": 36,
339+
"cell_type": "markdown",
341340
"metadata": {},
342-
"outputs": [
343-
{
344-
"data": {
345-
"text/html": [
346-
"<script>requirejs.config({paths: { 'plotly': ['https://cdn.plot.ly/plotly-latest.min']},});if(!window.Plotly) {{require(['plotly'],function(plotly) {window.Plotly=plotly;});}}</script>"
347-
],
348-
"text/vnd.plotly.v1+html": [
349-
"<script>requirejs.config({paths: { 'plotly': ['https://cdn.plot.ly/plotly-latest.min']},});if(!window.Plotly) {{require(['plotly'],function(plotly) {window.Plotly=plotly;});}}</script>"
350-
]
351-
},
352-
"metadata": {},
353-
"output_type": "display_data"
354-
}
355-
],
356341
"source": [
357342
"plotly.offline.init_notebook_mode(connected=True)"
358343
]
359344
},
360345
{
361346
"cell_type": "code",
362-
"execution_count": 41,
347+
"execution_count": 19,
363348
"metadata": {},
364349
"outputs": [
365350
{
@@ -403,13 +388,7 @@
403388
}
404389
],
405390
"layout": {}
406-
},
407-
"text/html": [
408-
"<div id=\"063fb6da-0c8c-4f88-90d3-1f84e30a3c31\" style=\"height: 525px; width: 100%;\" class=\"plotly-graph-div\"></div><script type=\"text/javascript\">require([\"plotly\"], function(Plotly) { window.PLOTLYENV=window.PLOTLYENV || {};window.PLOTLYENV.BASE_URL=\"https://plot.ly\";Plotly.newPlot(\"063fb6da-0c8c-4f88-90d3-1f84e30a3c31\", [{\"type\": \"bar\", \"x\": [\"2018-1\", \"2017-12\", \"2017-11\", \"2017-10\", \"2017-9\", \"2017-8\", \"2017-7\", \"2017-6\", \"2017-5\", \"2017-4\", \"2017-3\", \"2017-2\", \"2017-1\", \"2016-12\"], \"y\": [3, 11, 12, 13, 13, 19, 23, 19, 22, 23, 25, 20, 27, 13]}], {}, {\"showLink\": true, \"linkText\": \"Export to plot.ly\"})});</script>"
409-
],
410-
"text/vnd.plotly.v1+html": [
411-
"<div id=\"063fb6da-0c8c-4f88-90d3-1f84e30a3c31\" style=\"height: 525px; width: 100%;\" class=\"plotly-graph-div\"></div><script type=\"text/javascript\">require([\"plotly\"], function(Plotly) { window.PLOTLYENV=window.PLOTLYENV || {};window.PLOTLYENV.BASE_URL=\"https://plot.ly\";Plotly.newPlot(\"063fb6da-0c8c-4f88-90d3-1f84e30a3c31\", [{\"type\": \"bar\", \"x\": [\"2018-1\", \"2017-12\", \"2017-11\", \"2017-10\", \"2017-9\", \"2017-8\", \"2017-7\", \"2017-6\", \"2017-5\", \"2017-4\", \"2017-3\", \"2017-2\", \"2017-1\", \"2016-12\"], \"y\": [3, 11, 12, 13, 13, 19, 23, 19, 22, 23, 25, 20, 27, 13]}], {}, {\"showLink\": true, \"linkText\": \"Export to plot.ly\"})});</script>"
412-
]
391+
}
413392
},
414393
"metadata": {},
415394
"output_type": "display_data"
@@ -422,12 +401,19 @@
422401
]
423402
},
424403
{
425-
"cell_type": "raw",
404+
"cell_type": "markdown",
426405
"metadata": {},
427406
"source": [
428407
"https://plot.ly/create/?fid=bbelderbos:5"
429408
]
430409
},
410+
{
411+
"cell_type": "markdown",
412+
"metadata": {},
413+
"source": [
414+
"<img src=\"images/plot1.png\">"
415+
]
416+
},
431417
{
432418
"cell_type": "markdown",
433419
"metadata": {},
@@ -437,7 +423,7 @@
437423
},
438424
{
439425
"cell_type": "code",
440-
"execution_count": 42,
426+
"execution_count": 16,
441427
"metadata": {},
442428
"outputs": [
443429
{
@@ -463,13 +449,7 @@
463449
}
464450
],
465451
"layout": {}
466-
},
467-
"text/html": [
468-
"<div id=\"0f4a24f9-8a46-475e-b338-847ff0815cc6\" style=\"height: 525px; width: 100%;\" class=\"plotly-graph-div\"></div><script type=\"text/javascript\">require([\"plotly\"], function(Plotly) { window.PLOTLYENV=window.PLOTLYENV || {};window.PLOTLYENV.BASE_URL=\"https://plot.ly\";Plotly.newPlot(\"0f4a24f9-8a46-475e-b338-847ff0815cc6\", [{\"type\": \"pie\", \"labels\": [\"challenge\", \"article\", \"news\", \"special\", \"guest\"], \"values\": [89, 89, 55, 5, 5]}], {}, {\"showLink\": true, \"linkText\": \"Export to plot.ly\"})});</script>"
469-
],
470-
"text/vnd.plotly.v1+html": [
471-
"<div id=\"0f4a24f9-8a46-475e-b338-847ff0815cc6\" style=\"height: 525px; width: 100%;\" class=\"plotly-graph-div\"></div><script type=\"text/javascript\">require([\"plotly\"], function(Plotly) { window.PLOTLYENV=window.PLOTLYENV || {};window.PLOTLYENV.BASE_URL=\"https://plot.ly\";Plotly.newPlot(\"0f4a24f9-8a46-475e-b338-847ff0815cc6\", [{\"type\": \"pie\", \"labels\": [\"challenge\", \"article\", \"news\", \"special\", \"guest\"], \"values\": [89, 89, 55, 5, 5]}], {}, {\"showLink\": true, \"linkText\": \"Export to plot.ly\"})});</script>"
472-
]
452+
}
473453
},
474454
"metadata": {},
475455
"output_type": "display_data"
@@ -488,6 +468,13 @@
488468
"https://plot.ly/create/?fid=bbelderbos:7"
489469
]
490470
},
471+
{
472+
"cell_type": "markdown",
473+
"metadata": {},
474+
"source": [
475+
"<img src=\"images/plot2.png\">"
476+
]
477+
},
491478
{
492479
"cell_type": "markdown",
493480
"metadata": {},
@@ -497,7 +484,7 @@
497484
},
498485
{
499486
"cell_type": "code",
500-
"execution_count": 43,
487+
"execution_count": 20,
501488
"metadata": {},
502489
"outputs": [
503490
{
@@ -553,13 +540,7 @@
553540
}
554541
],
555542
"layout": {}
556-
},
557-
"text/html": [
558-
"<div id=\"44d1d1b1-211e-4ca1-9c01-d55616c9897e\" style=\"height: 525px; width: 100%;\" class=\"plotly-graph-div\"></div><script type=\"text/javascript\">require([\"plotly\"], function(Plotly) { window.PLOTLYENV=window.PLOTLYENV || {};window.PLOTLYENV.BASE_URL=\"https://plot.ly\";Plotly.newPlot(\"44d1d1b1-211e-4ca1-9c01-d55616c9897e\", [{\"type\": \"pie\", \"labels\": [\"python\", \"learning\", \"twitter\", \"codechallenges\", \"tips\", \"news\", \"flask\", \"django\", \"code\", \"github\", \"automation\", \"pybites\", \"data science\", \"apis\", \"machine learning\", \"books\", \"jupyter\", \"api\", \"regex\", \"pandas\"], \"values\": [84, 80, 72, 72, 65, 57, 54, 40, 27, 25, 24, 23, 23, 21, 20, 20, 19, 19, 18, 18]}], {}, {\"showLink\": true, \"linkText\": \"Export to plot.ly\"})});</script>"
559-
],
560-
"text/vnd.plotly.v1+html": [
561-
"<div id=\"44d1d1b1-211e-4ca1-9c01-d55616c9897e\" style=\"height: 525px; width: 100%;\" class=\"plotly-graph-div\"></div><script type=\"text/javascript\">require([\"plotly\"], function(Plotly) { window.PLOTLYENV=window.PLOTLYENV || {};window.PLOTLYENV.BASE_URL=\"https://plot.ly\";Plotly.newPlot(\"44d1d1b1-211e-4ca1-9c01-d55616c9897e\", [{\"type\": \"pie\", \"labels\": [\"python\", \"learning\", \"twitter\", \"codechallenges\", \"tips\", \"news\", \"flask\", \"django\", \"code\", \"github\", \"automation\", \"pybites\", \"data science\", \"apis\", \"machine learning\", \"books\", \"jupyter\", \"api\", \"regex\", \"pandas\"], \"values\": [84, 80, 72, 72, 65, 57, 54, 40, 27, 25, 24, 23, 23, 21, 20, 20, 19, 19, 18, 18]}], {}, {\"showLink\": true, \"linkText\": \"Export to plot.ly\"})});</script>"
562-
]
543+
}
563544
},
564545
"metadata": {},
565546
"output_type": "display_data"
@@ -578,6 +559,13 @@
578559
"https://plot.ly/create/?fid=bbelderbos:9"
579560
]
580561
},
562+
{
563+
"cell_type": "markdown",
564+
"metadata": {},
565+
"source": [
566+
"<img src=\"images/plot3.png\">"
567+
]
568+
},
581569
{
582570
"cell_type": "markdown",
583571
"metadata": {},
16.6 KB
Loading
29.1 KB
Loading
66.6 KB
Loading

0 commit comments

Comments
 (0)