j1-template 2022.2.2 → 2022.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/_includes/themes/j1/blocks/footer/boxes/contacts_box.proc +46 -18
- data/_includes/themes/j1/blocks/footer/boxes/links_box.proc +1 -0
- data/assets/data/fab.html +2 -2
- data/assets/data/footer.html +2 -2
- data/assets/themes/j1/core/css/themes/unolight/bootstrap.css +64 -206
- data/assets/themes/j1/core/css/themes/unolight/bootstrap.min.css +2 -2
- data/assets/themes/j1/modules/nbInteract/README.md +169 -0
- data/assets/themes/j1/modules/nbInteract/css/nbinteract-core.css +4 -0
- data/assets/themes/j1/modules/nbInteract/css/nbinteract-core.min.css +4 -0
- data/lib/j1/version.rb +1 -1
- data/lib/starter_web/Gemfile +1 -1
- data/lib/starter_web/_config.yml +1 -1
- data/lib/starter_web/_data/blocks/defaults/footer.yml +25 -17
- data/lib/starter_web/_data/blocks/footer.yml +78 -65
- data/lib/starter_web/_data/resources.yml +0 -22
- data/lib/starter_web/_includes/attributes.asciidoc +14 -0
- data/lib/starter_web/_plugins/lunr_index.rb +1 -1
- data/lib/starter_web/assets/images/pages/nbinteract/nbi-textbook-example.jpg +0 -0
- data/lib/starter_web/package.json +1 -1
- data/lib/starter_web/pages/public/jupyter/docs/_includes/documents/j1_docs_example_static.asciidoc +232 -232
- data/lib/starter_web/pages/public/jupyter/docs/j1-nbinteract-doc.adoc +135 -134
- data/lib/starter_web/pages/public/jupyter/docs/nbi-widget-manual.adoc +2 -4
- data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_interactive_widgets-checkpoint.ipynb +170 -15
- data/lib/starter_web/pages/public/jupyter/notebooks/j1/j1_interactive_widgets.ipynb +170 -15
- data/lib/starter_web/pages/public/jupyter/notebooks/nbi-docs/.ipynb_checkpoints/nbi_docs_recipes_interactive_questions-checkpoint.ipynb +185 -0
- data/lib/starter_web/pages/public/jupyter/notebooks/nbi-docs/nbi_docs_recipes_interactive_questions.ipynb +19 -22
- data/lib/starter_web/pages/public/jupyter/notebooks/textbooks/binder-launches.html +670 -546
- data/lib/starter_web/pages/public/jupyter/notebooks/textbooks/j1_docs_example_dynamic.html +186 -186
- data/lib/starter_web/pages/public/jupyter/notebooks/textbooks/j1_interactive_widgets.html +919 -702
- data/lib/starter_web/pages/public/jupyter/notebooks/textbooks/j1_ode_selected.html +186 -186
- data/lib/starter_web/pages/public/jupyter/notebooks/textbooks/nbi_docs_recipes_interactive_questions.html +242 -243
- data/lib/starter_web/pages/public/jupyter/{apis/binderhub-api.adoc → services/binderhub.adoc} +22 -25
- data/lib/starter_web/pages/public/jupyter/{apis/jupyterhub-api.adoc → services/jupyterhub.adoc} +2 -2
- data/lib/starter_web/pages/public/learn/roundtrip/300_icon_fonts.adoc +11 -0
- data/lib/starter_web/utilsrv/_defaults/package.json +1 -1
- data/lib/starter_web/utilsrv/package.json +1 -1
- metadata +7 -28
- data/lib/starter_web/_data/_resources.yml +0 -1668
- data/lib/starter_web/assets/images/pages/nbinteract/binderhub-architecture.png +0 -0
- data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/algebra_with_sympy-checkpoint.ipynb +0 -14488
- data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/climate-change-forecast-checkpoint.ipynb +0 -916
- data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/ipympl_test_plots-checkpoint.ipynb +0 -14517
- data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_algebra_with_sympy-checkpoint.ipynb +0 -14517
- data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_altair_interactive-checkpoint.ipynb +0 -16493
- data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_altair_visualization-checkpoint.ipynb +0 -15358
- data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_altair_visualization_full-checkpoint.ipynb +0 -2576
- data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_climate_change_forecast-checkpoint.ipynb +0 -1058
- data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_climate_change_forecast.ipynb +0 -1060
- data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_docs_example_dynamic-checkpoint.ipynb +0 -14478
- data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_docs_hist-checkpoint.ipynb +0 -98
- data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_interactive-checkpoint.ipynb +0 -560
- data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_ipympl_test_plots-checkpoint.ipynb +0 -14511
- data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_ode_selected-checkpoint.ipynb +0 -14478
- data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_odes_in_python-checkpoint.ipynb +0 -14818
- data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_pandas_creating_reading_and_writing-checkpoint.ipynb +0 -328
- data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_recipes_layout-checkpoint.ipynb +0 -341
- data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/nbi_docs_recipes_graphing-checkpoint.ipynb +0 -98
- data/lib/starter_web/pages/public/jupyter/notebooks/nbi-docs/.ipynb_checkpoints/nbi_docs_examples_correlation-checkpoint.ipynb +0 -651
- data/lib/starter_web/pages/public/jupyter/notebooks/nbi-docs/.ipynb_checkpoints/nbi_docs_examples_variability_of_the_sample_mean-checkpoint.ipynb +0 -323
- data/lib/starter_web/pages/public/jupyter/notebooks/nbi-docs/.ipynb_checkpoints/nbi_docs_recipes_graphing-checkpoint.ipynb +0 -387
- data/lib/starter_web/pages/public/jupyter/notebooks/nbi-docs/.ipynb_checkpoints/nbi_docs_recipes_layout-checkpoint.ipynb +0 -384
@@ -1,546 +1,670 @@
|
|
1
|
-
<div class="cell text_cell">
|
2
|
-
<button class="js-nbinteract-widget">
|
3
|
-
Loading widgets...
|
4
|
-
</button>
|
5
|
-
</div>
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
<div class="cell border-box-sizing text_cell rendered"><div class="inner_cell">
|
10
|
-
<div class="text_cell_render border-box-sizing rendered_html">
|
11
|
-
<h1 id="Analysing-mybinder.org-launches">Analysing mybinder.org launches<a class="anchor-link" href="#Analysing-mybinder.org-launches">¶</a></h1><p>The first few cells download and massage the data. Later on we answer questions on which repositories are popular and such.</p>
|
12
|
-
|
13
|
-
</div>
|
14
|
-
</div>
|
15
|
-
</div>
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
<div class="
|
20
|
-
cell border-box-sizing code_cell rendered">
|
21
|
-
<div class="input">
|
22
|
-
|
23
|
-
<div class="inner_cell">
|
24
|
-
<div class="input_area">
|
25
|
-
<div class=" highlight hl-ipython3"><pre><span></span><span class="o">%</span><span class="k">matplotlib</span> inline
|
26
|
-
|
27
|
-
<span class="kn">import</span> <span class="nn">matplotlib.pyplot</span> <span class="k">as</span> <span class="nn">plt</span>
|
28
|
-
<span class="kn">import</span> <span class="nn">datetime</span>
|
29
|
-
<span class="kn">import</span> <span class="nn">pandas</span> <span class="k">as</span> <span class="nn">pd</span>
|
30
|
-
</pre></div>
|
31
|
-
|
32
|
-
</div>
|
33
|
-
</div>
|
34
|
-
</div>
|
35
|
-
|
36
|
-
</div>
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
<div class="
|
41
|
-
cell border-box-sizing code_cell rendered">
|
42
|
-
<div class="input">
|
43
|
-
|
44
|
-
<div class="inner_cell">
|
45
|
-
<div class="input_area">
|
46
|
-
<div class=" highlight hl-ipython3"><pre><span></span><span class="n">index</span> <span class="o">=</span> <span class="n">pd</span><span class="o">.</span><span class="n">read_json</span><span class="p">(</span><span class="s2">"https://archive.analytics.mybinder.org/index.jsonl"</span><span class="p">,</span>
|
47
|
-
<span class="n">lines</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
|
48
|
-
</pre></div>
|
49
|
-
|
50
|
-
</div>
|
51
|
-
</div>
|
52
|
-
</div>
|
53
|
-
|
54
|
-
</div>
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
<div class="
|
59
|
-
cell border-box-sizing code_cell rendered">
|
60
|
-
<div class="input">
|
61
|
-
|
62
|
-
<div class="inner_cell">
|
63
|
-
<div class="input_area">
|
64
|
-
<div class=" highlight hl-ipython3"><pre><span></span><span class="c1"># get all days since start of 2019</span>
|
65
|
-
<span class="n">now</span> <span class="o">=</span> <span class="n">datetime</span><span class="o">.</span><span class="n">datetime</span><span class="o">.</span><span class="n">now</span><span class="p">()</span>
|
66
|
-
<span class="n">n</span> <span class="o">=</span> <span class="p">(</span><span class="n">now</span> <span class="o">-</span> <span class="n">datetime</span><span class="o">.</span><span class="n">datetime</span><span class="p">(</span><span class="mi">2019</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">))</span><span class="o">.</span><span class="n">days</span>
|
67
|
-
|
68
|
-
<span class="c1"># small range for previewing</span>
|
69
|
-
<span class="c1">#n = 30</span>
|
70
|
-
|
71
|
-
<span class="n">frames</span> <span class="o">=</span> <span class="p">[]</span>
|
72
|
-
<span class="k">for</span> <span class="n">idx</span><span class="p">,</span> <span class="n">day</span> <span class="ow">in</span> <span class="n">index</span><span class="o">.</span><span class="n">sort_index</span><span class="p">(</span><span class="n">ascending</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span><span class="o">.</span><span class="n">iterrows</span><span class="p">():</span>
|
73
|
-
<span class="n">df</span> <span class="o">=</span> <span class="n">pd</span><span class="o">.</span><span class="n">read_json</span><span class="p">(</span><span class="s2">"https://archive.analytics.mybinder.org/</span><span class="si">{}</span><span class="s2">"</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">day</span><span class="p">[</span><span class="s1">'name'</span><span class="p">]),</span>
|
74
|
-
<span class="n">lines</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="p">)</span>
|
75
|
-
<span class="n">frames</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">df</span><span class="p">)</span>
|
76
|
-
<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">frames</span><span class="p">)</span> <span class="o">></span> <span class="n">n</span><span class="p">:</span>
|
77
|
-
<span class="k">break</span>
|
78
|
-
|
79
|
-
<span class="nb">print</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Fetched data for </span><span class="si">{</span><span class="n">n</span><span class="si">}</span><span class="s2"> days."</span><span class="p">)</span>
|
80
|
-
</pre></div>
|
81
|
-
|
82
|
-
</div>
|
83
|
-
</div>
|
84
|
-
</div>
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
<div class="
|
95
|
-
|
96
|
-
<
|
97
|
-
</
|
98
|
-
|
99
|
-
|
100
|
-
</
|
101
|
-
</
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
<
|
114
|
-
<span class="
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
<span class="
|
120
|
-
<span class="
|
121
|
-
<span class="
|
122
|
-
</
|
123
|
-
|
124
|
-
</
|
125
|
-
|
126
|
-
</
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
<
|
135
|
-
|
136
|
-
<
|
137
|
-
|
138
|
-
<
|
139
|
-
|
140
|
-
</
|
141
|
-
|
142
|
-
</
|
143
|
-
</
|
144
|
-
</
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
<
|
153
|
-
|
154
|
-
<
|
155
|
-
<
|
156
|
-
<
|
157
|
-
</
|
158
|
-
|
159
|
-
</
|
160
|
-
|
161
|
-
</
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
<
|
170
|
-
|
171
|
-
<
|
172
|
-
|
173
|
-
<
|
174
|
-
|
175
|
-
|
176
|
-
</
|
177
|
-
</
|
178
|
-
</
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
<
|
183
|
-
<
|
184
|
-
</
|
185
|
-
</
|
186
|
-
</
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
<
|
195
|
-
|
196
|
-
<
|
197
|
-
</
|
198
|
-
|
199
|
-
|
200
|
-
</
|
201
|
-
</
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
<
|
217
|
-
|
218
|
-
<
|
219
|
-
<
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
</
|
240
|
-
</
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
<
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
</div>
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
</div>
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
<div class="
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
</
|
302
|
-
|
303
|
-
|
304
|
-
</div>
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
<div class="
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
</
|
325
|
-
|
326
|
-
|
327
|
-
</div>
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
<div class="
|
337
|
-
|
338
|
-
<
|
339
|
-
|
340
|
-
<
|
341
|
-
</
|
342
|
-
|
343
|
-
</
|
344
|
-
</
|
345
|
-
</
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
<
|
350
|
-
<
|
351
|
-
|
352
|
-
</
|
353
|
-
</
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
<div class="
|
392
|
-
|
393
|
-
<
|
394
|
-
|
395
|
-
|
396
|
-
</
|
397
|
-
</
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
<
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
</div>
|
413
|
-
</div>
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
<div class="
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
</
|
429
|
-
|
430
|
-
|
431
|
-
</div>
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
<
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
</div>
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
<div class="
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
</
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
<div class="
|
531
|
-
<span class="o">.</span><span class="n">
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
</
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
1
|
+
<div class="cell text_cell">
|
2
|
+
<button class="js-nbinteract-widget">
|
3
|
+
Loading widgets...
|
4
|
+
</button>
|
5
|
+
</div>
|
6
|
+
|
7
|
+
|
8
|
+
|
9
|
+
<div class="cell border-box-sizing text_cell rendered"><div class="inner_cell">
|
10
|
+
<div class="text_cell_render border-box-sizing rendered_html">
|
11
|
+
<h1 id="Analysing-mybinder.org-launches">Analysing mybinder.org launches<a class="anchor-link" href="#Analysing-mybinder.org-launches">¶</a></h1><p>The first few cells download and massage the data. Later on we answer questions on which repositories are popular and such.</p>
|
12
|
+
|
13
|
+
</div>
|
14
|
+
</div>
|
15
|
+
</div>
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
<div class="
|
20
|
+
cell border-box-sizing code_cell rendered">
|
21
|
+
<div class="input">
|
22
|
+
|
23
|
+
<div class="inner_cell">
|
24
|
+
<div class="input_area">
|
25
|
+
<div class=" highlight hl-ipython3"><pre><span></span><span class="o">%</span><span class="k">matplotlib</span> inline
|
26
|
+
|
27
|
+
<span class="kn">import</span> <span class="nn">matplotlib.pyplot</span> <span class="k">as</span> <span class="nn">plt</span>
|
28
|
+
<span class="kn">import</span> <span class="nn">datetime</span>
|
29
|
+
<span class="kn">import</span> <span class="nn">pandas</span> <span class="k">as</span> <span class="nn">pd</span>
|
30
|
+
</pre></div>
|
31
|
+
|
32
|
+
</div>
|
33
|
+
</div>
|
34
|
+
</div>
|
35
|
+
|
36
|
+
</div>
|
37
|
+
|
38
|
+
|
39
|
+
|
40
|
+
<div class="
|
41
|
+
cell border-box-sizing code_cell rendered">
|
42
|
+
<div class="input">
|
43
|
+
|
44
|
+
<div class="inner_cell">
|
45
|
+
<div class="input_area">
|
46
|
+
<div class=" highlight hl-ipython3"><pre><span></span><span class="n">index</span> <span class="o">=</span> <span class="n">pd</span><span class="o">.</span><span class="n">read_json</span><span class="p">(</span><span class="s2">"https://archive.analytics.mybinder.org/index.jsonl"</span><span class="p">,</span>
|
47
|
+
<span class="n">lines</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
|
48
|
+
</pre></div>
|
49
|
+
|
50
|
+
</div>
|
51
|
+
</div>
|
52
|
+
</div>
|
53
|
+
|
54
|
+
</div>
|
55
|
+
|
56
|
+
|
57
|
+
|
58
|
+
<div class="
|
59
|
+
cell border-box-sizing code_cell rendered">
|
60
|
+
<div class="input">
|
61
|
+
|
62
|
+
<div class="inner_cell">
|
63
|
+
<div class="input_area">
|
64
|
+
<div class=" highlight hl-ipython3"><pre><span></span><span class="c1"># get all days since start of 2019</span>
|
65
|
+
<span class="n">now</span> <span class="o">=</span> <span class="n">datetime</span><span class="o">.</span><span class="n">datetime</span><span class="o">.</span><span class="n">now</span><span class="p">()</span>
|
66
|
+
<span class="n">n</span> <span class="o">=</span> <span class="p">(</span><span class="n">now</span> <span class="o">-</span> <span class="n">datetime</span><span class="o">.</span><span class="n">datetime</span><span class="p">(</span><span class="mi">2019</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">))</span><span class="o">.</span><span class="n">days</span>
|
67
|
+
|
68
|
+
<span class="c1"># small range for previewing</span>
|
69
|
+
<span class="c1">#n = 30</span>
|
70
|
+
|
71
|
+
<span class="n">frames</span> <span class="o">=</span> <span class="p">[]</span>
|
72
|
+
<span class="k">for</span> <span class="n">idx</span><span class="p">,</span> <span class="n">day</span> <span class="ow">in</span> <span class="n">index</span><span class="o">.</span><span class="n">sort_index</span><span class="p">(</span><span class="n">ascending</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span><span class="o">.</span><span class="n">iterrows</span><span class="p">():</span>
|
73
|
+
<span class="n">df</span> <span class="o">=</span> <span class="n">pd</span><span class="o">.</span><span class="n">read_json</span><span class="p">(</span><span class="s2">"https://archive.analytics.mybinder.org/</span><span class="si">{}</span><span class="s2">"</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">day</span><span class="p">[</span><span class="s1">'name'</span><span class="p">]),</span>
|
74
|
+
<span class="n">lines</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="p">)</span>
|
75
|
+
<span class="n">frames</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">df</span><span class="p">)</span>
|
76
|
+
<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">frames</span><span class="p">)</span> <span class="o">></span> <span class="n">n</span><span class="p">:</span>
|
77
|
+
<span class="k">break</span>
|
78
|
+
|
79
|
+
<span class="nb">print</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Fetched data for </span><span class="si">{</span><span class="n">n</span><span class="si">}</span><span class="s2"> days."</span><span class="p">)</span>
|
80
|
+
</pre></div>
|
81
|
+
|
82
|
+
</div>
|
83
|
+
</div>
|
84
|
+
</div>
|
85
|
+
|
86
|
+
<div class="output_wrapper">
|
87
|
+
<div class="output">
|
88
|
+
|
89
|
+
|
90
|
+
<div class="output_area">
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
<div class="output_subarea output_text output_error">
|
95
|
+
<pre>
|
96
|
+
<span class="ansi-red-intense-fg ansi-bold">---------------------------------------------------------------------------</span>
|
97
|
+
<span class="ansi-red-intense-fg ansi-bold">HTTPError</span> Traceback (most recent call last)
|
98
|
+
<span class="ansi-green-intense-fg ansi-bold"><ipython-input-3-dc969cf0de9b></span> in <span class="ansi-cyan-fg"><module></span>
|
99
|
+
<span class="ansi-green-fg"> 9</span> <span class="ansi-green-intense-fg ansi-bold">for</span> idx<span class="ansi-yellow-intense-fg ansi-bold">,</span> day <span class="ansi-green-intense-fg ansi-bold">in</span> index<span class="ansi-yellow-intense-fg ansi-bold">.</span>sort_index<span class="ansi-yellow-intense-fg ansi-bold">(</span>ascending<span class="ansi-yellow-intense-fg ansi-bold">=</span><span class="ansi-green-intense-fg ansi-bold">False</span><span class="ansi-yellow-intense-fg ansi-bold">)</span><span class="ansi-yellow-intense-fg ansi-bold">.</span>iterrows<span class="ansi-yellow-intense-fg ansi-bold">(</span><span class="ansi-yellow-intense-fg ansi-bold">)</span><span class="ansi-yellow-intense-fg ansi-bold">:</span>
|
100
|
+
<span class="ansi-green-fg"> 10</span> df = pd.read_json("https://archive.analytics.mybinder.org/{}".format(day['name']),
|
101
|
+
<span class="ansi-green-intense-fg ansi-bold">---> 11</span><span class="ansi-yellow-intense-fg ansi-bold"> lines=True, )
|
102
|
+
</span><span class="ansi-green-fg"> 12</span> frames<span class="ansi-yellow-intense-fg ansi-bold">.</span>append<span class="ansi-yellow-intense-fg ansi-bold">(</span>df<span class="ansi-yellow-intense-fg ansi-bold">)</span>
|
103
|
+
<span class="ansi-green-fg"> 13</span> <span class="ansi-green-intense-fg ansi-bold">if</span> len<span class="ansi-yellow-intense-fg ansi-bold">(</span>frames<span class="ansi-yellow-intense-fg ansi-bold">)</span> <span class="ansi-yellow-intense-fg ansi-bold">></span> n<span class="ansi-yellow-intense-fg ansi-bold">:</span>
|
104
|
+
|
105
|
+
<span class="ansi-green-intense-fg ansi-bold">c:\devtools\python-3.7.9\lib\site-packages\pandas\util\_decorators.py</span> in <span class="ansi-cyan-fg">wrapper</span><span class="ansi-blue-intense-fg ansi-bold">(*args, **kwargs)</span>
|
106
|
+
<span class="ansi-green-fg"> 197</span> <span class="ansi-green-intense-fg ansi-bold">else</span><span class="ansi-yellow-intense-fg ansi-bold">:</span>
|
107
|
+
<span class="ansi-green-fg"> 198</span> kwargs<span class="ansi-yellow-intense-fg ansi-bold">[</span>new_arg_name<span class="ansi-yellow-intense-fg ansi-bold">]</span> <span class="ansi-yellow-intense-fg ansi-bold">=</span> new_arg_value
|
108
|
+
<span class="ansi-green-intense-fg ansi-bold">--> 199</span><span class="ansi-yellow-intense-fg ansi-bold"> </span><span class="ansi-green-intense-fg ansi-bold">return</span> func<span class="ansi-yellow-intense-fg ansi-bold">(</span><span class="ansi-yellow-intense-fg ansi-bold">*</span>args<span class="ansi-yellow-intense-fg ansi-bold">,</span> <span class="ansi-yellow-intense-fg ansi-bold">**</span>kwargs<span class="ansi-yellow-intense-fg ansi-bold">)</span>
|
109
|
+
<span class="ansi-green-fg"> 200</span>
|
110
|
+
<span class="ansi-green-fg"> 201</span> <span class="ansi-green-intense-fg ansi-bold">return</span> cast<span class="ansi-yellow-intense-fg ansi-bold">(</span>F<span class="ansi-yellow-intense-fg ansi-bold">,</span> wrapper<span class="ansi-yellow-intense-fg ansi-bold">)</span>
|
111
|
+
|
112
|
+
<span class="ansi-green-intense-fg ansi-bold">c:\devtools\python-3.7.9\lib\site-packages\pandas\util\_decorators.py</span> in <span class="ansi-cyan-fg">wrapper</span><span class="ansi-blue-intense-fg ansi-bold">(*args, **kwargs)</span>
|
113
|
+
<span class="ansi-green-fg"> 297</span> )
|
114
|
+
<span class="ansi-green-fg"> 298</span> warnings<span class="ansi-yellow-intense-fg ansi-bold">.</span>warn<span class="ansi-yellow-intense-fg ansi-bold">(</span>msg<span class="ansi-yellow-intense-fg ansi-bold">,</span> FutureWarning<span class="ansi-yellow-intense-fg ansi-bold">,</span> stacklevel<span class="ansi-yellow-intense-fg ansi-bold">=</span>stacklevel<span class="ansi-yellow-intense-fg ansi-bold">)</span>
|
115
|
+
<span class="ansi-green-intense-fg ansi-bold">--> 299</span><span class="ansi-yellow-intense-fg ansi-bold"> </span><span class="ansi-green-intense-fg ansi-bold">return</span> func<span class="ansi-yellow-intense-fg ansi-bold">(</span><span class="ansi-yellow-intense-fg ansi-bold">*</span>args<span class="ansi-yellow-intense-fg ansi-bold">,</span> <span class="ansi-yellow-intense-fg ansi-bold">**</span>kwargs<span class="ansi-yellow-intense-fg ansi-bold">)</span>
|
116
|
+
<span class="ansi-green-fg"> 300</span>
|
117
|
+
<span class="ansi-green-fg"> 301</span> <span class="ansi-green-intense-fg ansi-bold">return</span> wrapper
|
118
|
+
|
119
|
+
<span class="ansi-green-intense-fg ansi-bold">c:\devtools\python-3.7.9\lib\site-packages\pandas\io\json\_json.py</span> in <span class="ansi-cyan-fg">read_json</span><span class="ansi-blue-intense-fg ansi-bold">(path_or_buf, orient, typ, dtype, convert_axes, convert_dates, keep_default_dates, numpy, precise_float, date_unit, encoding, lines, chunksize, compression, nrows, storage_options)</span>
|
120
|
+
<span class="ansi-green-fg"> 554</span> compression<span class="ansi-yellow-intense-fg ansi-bold">=</span>compression<span class="ansi-yellow-intense-fg ansi-bold">,</span>
|
121
|
+
<span class="ansi-green-fg"> 555</span> nrows<span class="ansi-yellow-intense-fg ansi-bold">=</span>nrows<span class="ansi-yellow-intense-fg ansi-bold">,</span>
|
122
|
+
<span class="ansi-green-intense-fg ansi-bold">--> 556</span><span class="ansi-yellow-intense-fg ansi-bold"> </span>storage_options<span class="ansi-yellow-intense-fg ansi-bold">=</span>storage_options<span class="ansi-yellow-intense-fg ansi-bold">,</span>
|
123
|
+
<span class="ansi-green-fg"> 557</span> )
|
124
|
+
<span class="ansi-green-fg"> 558</span>
|
125
|
+
|
126
|
+
<span class="ansi-green-intense-fg ansi-bold">c:\devtools\python-3.7.9\lib\site-packages\pandas\io\json\_json.py</span> in <span class="ansi-cyan-fg">__init__</span><span class="ansi-blue-intense-fg ansi-bold">(self, filepath_or_buffer, orient, typ, dtype, convert_axes, convert_dates, keep_default_dates, numpy, precise_float, date_unit, encoding, lines, chunksize, compression, nrows, storage_options)</span>
|
127
|
+
<span class="ansi-green-fg"> 620</span> <span class="ansi-green-intense-fg ansi-bold">raise</span> ValueError<span class="ansi-yellow-intense-fg ansi-bold">(</span><span class="ansi-blue-intense-fg ansi-bold">"nrows can only be passed if lines=True"</span><span class="ansi-yellow-intense-fg ansi-bold">)</span>
|
128
|
+
<span class="ansi-green-fg"> 621</span>
|
129
|
+
<span class="ansi-green-intense-fg ansi-bold">--> 622</span><span class="ansi-yellow-intense-fg ansi-bold"> </span>data <span class="ansi-yellow-intense-fg ansi-bold">=</span> self<span class="ansi-yellow-intense-fg ansi-bold">.</span>_get_data_from_filepath<span class="ansi-yellow-intense-fg ansi-bold">(</span>filepath_or_buffer<span class="ansi-yellow-intense-fg ansi-bold">)</span>
|
130
|
+
<span class="ansi-green-fg"> 623</span> self<span class="ansi-yellow-intense-fg ansi-bold">.</span>data <span class="ansi-yellow-intense-fg ansi-bold">=</span> self<span class="ansi-yellow-intense-fg ansi-bold">.</span>_preprocess_data<span class="ansi-yellow-intense-fg ansi-bold">(</span>data<span class="ansi-yellow-intense-fg ansi-bold">)</span>
|
131
|
+
<span class="ansi-green-fg"> 624</span>
|
132
|
+
|
133
|
+
<span class="ansi-green-intense-fg ansi-bold">c:\devtools\python-3.7.9\lib\site-packages\pandas\io\json\_json.py</span> in <span class="ansi-cyan-fg">_get_data_from_filepath</span><span class="ansi-blue-intense-fg ansi-bold">(self, filepath_or_buffer)</span>
|
134
|
+
<span class="ansi-green-fg"> 662</span> encoding<span class="ansi-yellow-intense-fg ansi-bold">=</span>self<span class="ansi-yellow-intense-fg ansi-bold">.</span>encoding<span class="ansi-yellow-intense-fg ansi-bold">,</span>
|
135
|
+
<span class="ansi-green-fg"> 663</span> compression<span class="ansi-yellow-intense-fg ansi-bold">=</span>self<span class="ansi-yellow-intense-fg ansi-bold">.</span>compression<span class="ansi-yellow-intense-fg ansi-bold">,</span>
|
136
|
+
<span class="ansi-green-intense-fg ansi-bold">--> 664</span><span class="ansi-yellow-intense-fg ansi-bold"> </span>storage_options<span class="ansi-yellow-intense-fg ansi-bold">=</span>self<span class="ansi-yellow-intense-fg ansi-bold">.</span>storage_options<span class="ansi-yellow-intense-fg ansi-bold">,</span>
|
137
|
+
<span class="ansi-green-fg"> 665</span> )
|
138
|
+
<span class="ansi-green-fg"> 666</span> filepath_or_buffer <span class="ansi-yellow-intense-fg ansi-bold">=</span> self<span class="ansi-yellow-intense-fg ansi-bold">.</span>handles<span class="ansi-yellow-intense-fg ansi-bold">.</span>handle
|
139
|
+
|
140
|
+
<span class="ansi-green-intense-fg ansi-bold">c:\devtools\python-3.7.9\lib\site-packages\pandas\io\common.py</span> in <span class="ansi-cyan-fg">get_handle</span><span class="ansi-blue-intense-fg ansi-bold">(path_or_buf, mode, encoding, compression, memory_map, is_text, errors, storage_options)</span>
|
141
|
+
<span class="ansi-green-fg"> 561</span> compression<span class="ansi-yellow-intense-fg ansi-bold">=</span>compression<span class="ansi-yellow-intense-fg ansi-bold">,</span>
|
142
|
+
<span class="ansi-green-fg"> 562</span> mode<span class="ansi-yellow-intense-fg ansi-bold">=</span>mode<span class="ansi-yellow-intense-fg ansi-bold">,</span>
|
143
|
+
<span class="ansi-green-intense-fg ansi-bold">--> 563</span><span class="ansi-yellow-intense-fg ansi-bold"> </span>storage_options<span class="ansi-yellow-intense-fg ansi-bold">=</span>storage_options<span class="ansi-yellow-intense-fg ansi-bold">,</span>
|
144
|
+
<span class="ansi-green-fg"> 564</span> )
|
145
|
+
<span class="ansi-green-fg"> 565</span>
|
146
|
+
|
147
|
+
<span class="ansi-green-intense-fg ansi-bold">c:\devtools\python-3.7.9\lib\site-packages\pandas\io\common.py</span> in <span class="ansi-cyan-fg">_get_filepath_or_buffer</span><span class="ansi-blue-intense-fg ansi-bold">(filepath_or_buffer, encoding, compression, mode, storage_options)</span>
|
148
|
+
<span class="ansi-green-fg"> 287</span> <span class="ansi-blue-intense-fg ansi-bold">"storage_options passed with file object or non-fsspec file path"</span>
|
149
|
+
<span class="ansi-green-fg"> 288</span> )
|
150
|
+
<span class="ansi-green-intense-fg ansi-bold">--> 289</span><span class="ansi-yellow-intense-fg ansi-bold"> </span>req <span class="ansi-yellow-intense-fg ansi-bold">=</span> urlopen<span class="ansi-yellow-intense-fg ansi-bold">(</span>filepath_or_buffer<span class="ansi-yellow-intense-fg ansi-bold">)</span>
|
151
|
+
<span class="ansi-green-fg"> 290</span> content_encoding <span class="ansi-yellow-intense-fg ansi-bold">=</span> req<span class="ansi-yellow-intense-fg ansi-bold">.</span>headers<span class="ansi-yellow-intense-fg ansi-bold">.</span>get<span class="ansi-yellow-intense-fg ansi-bold">(</span><span class="ansi-blue-intense-fg ansi-bold">"Content-Encoding"</span><span class="ansi-yellow-intense-fg ansi-bold">,</span> <span class="ansi-green-intense-fg ansi-bold">None</span><span class="ansi-yellow-intense-fg ansi-bold">)</span>
|
152
|
+
<span class="ansi-green-fg"> 291</span> <span class="ansi-green-intense-fg ansi-bold">if</span> content_encoding <span class="ansi-yellow-intense-fg ansi-bold">==</span> <span class="ansi-blue-intense-fg ansi-bold">"gzip"</span><span class="ansi-yellow-intense-fg ansi-bold">:</span>
|
153
|
+
|
154
|
+
<span class="ansi-green-intense-fg ansi-bold">c:\devtools\python-3.7.9\lib\site-packages\pandas\io\common.py</span> in <span class="ansi-cyan-fg">urlopen</span><span class="ansi-blue-intense-fg ansi-bold">(*args, **kwargs)</span>
|
155
|
+
<span class="ansi-green-fg"> 193</span> <span class="ansi-green-intense-fg ansi-bold">import</span> urllib<span class="ansi-yellow-intense-fg ansi-bold">.</span>request
|
156
|
+
<span class="ansi-green-fg"> 194</span>
|
157
|
+
<span class="ansi-green-intense-fg ansi-bold">--> 195</span><span class="ansi-yellow-intense-fg ansi-bold"> </span><span class="ansi-green-intense-fg ansi-bold">return</span> urllib<span class="ansi-yellow-intense-fg ansi-bold">.</span>request<span class="ansi-yellow-intense-fg ansi-bold">.</span>urlopen<span class="ansi-yellow-intense-fg ansi-bold">(</span><span class="ansi-yellow-intense-fg ansi-bold">*</span>args<span class="ansi-yellow-intense-fg ansi-bold">,</span> <span class="ansi-yellow-intense-fg ansi-bold">**</span>kwargs<span class="ansi-yellow-intense-fg ansi-bold">)</span>
|
158
|
+
<span class="ansi-green-fg"> 196</span>
|
159
|
+
<span class="ansi-green-fg"> 197</span>
|
160
|
+
|
161
|
+
<span class="ansi-green-intense-fg ansi-bold">c:\devtools\python-3.7.9\lib\urllib\request.py</span> in <span class="ansi-cyan-fg">urlopen</span><span class="ansi-blue-intense-fg ansi-bold">(url, data, timeout, cafile, capath, cadefault, context)</span>
|
162
|
+
<span class="ansi-green-fg"> 220</span> <span class="ansi-green-intense-fg ansi-bold">else</span><span class="ansi-yellow-intense-fg ansi-bold">:</span>
|
163
|
+
<span class="ansi-green-fg"> 221</span> opener <span class="ansi-yellow-intense-fg ansi-bold">=</span> _opener
|
164
|
+
<span class="ansi-green-intense-fg ansi-bold">--> 222</span><span class="ansi-yellow-intense-fg ansi-bold"> </span><span class="ansi-green-intense-fg ansi-bold">return</span> opener<span class="ansi-yellow-intense-fg ansi-bold">.</span>open<span class="ansi-yellow-intense-fg ansi-bold">(</span>url<span class="ansi-yellow-intense-fg ansi-bold">,</span> data<span class="ansi-yellow-intense-fg ansi-bold">,</span> timeout<span class="ansi-yellow-intense-fg ansi-bold">)</span>
|
165
|
+
<span class="ansi-green-fg"> 223</span>
|
166
|
+
<span class="ansi-green-fg"> 224</span> <span class="ansi-green-intense-fg ansi-bold">def</span> install_opener<span class="ansi-yellow-intense-fg ansi-bold">(</span>opener<span class="ansi-yellow-intense-fg ansi-bold">)</span><span class="ansi-yellow-intense-fg ansi-bold">:</span>
|
167
|
+
|
168
|
+
<span class="ansi-green-intense-fg ansi-bold">c:\devtools\python-3.7.9\lib\urllib\request.py</span> in <span class="ansi-cyan-fg">open</span><span class="ansi-blue-intense-fg ansi-bold">(self, fullurl, data, timeout)</span>
|
169
|
+
<span class="ansi-green-fg"> 529</span> <span class="ansi-green-intense-fg ansi-bold">for</span> processor <span class="ansi-green-intense-fg ansi-bold">in</span> self<span class="ansi-yellow-intense-fg ansi-bold">.</span>process_response<span class="ansi-yellow-intense-fg ansi-bold">.</span>get<span class="ansi-yellow-intense-fg ansi-bold">(</span>protocol<span class="ansi-yellow-intense-fg ansi-bold">,</span> <span class="ansi-yellow-intense-fg ansi-bold">[</span><span class="ansi-yellow-intense-fg ansi-bold">]</span><span class="ansi-yellow-intense-fg ansi-bold">)</span><span class="ansi-yellow-intense-fg ansi-bold">:</span>
|
170
|
+
<span class="ansi-green-fg"> 530</span> meth <span class="ansi-yellow-intense-fg ansi-bold">=</span> getattr<span class="ansi-yellow-intense-fg ansi-bold">(</span>processor<span class="ansi-yellow-intense-fg ansi-bold">,</span> meth_name<span class="ansi-yellow-intense-fg ansi-bold">)</span>
|
171
|
+
<span class="ansi-green-intense-fg ansi-bold">--> 531</span><span class="ansi-yellow-intense-fg ansi-bold"> </span>response <span class="ansi-yellow-intense-fg ansi-bold">=</span> meth<span class="ansi-yellow-intense-fg ansi-bold">(</span>req<span class="ansi-yellow-intense-fg ansi-bold">,</span> response<span class="ansi-yellow-intense-fg ansi-bold">)</span>
|
172
|
+
<span class="ansi-green-fg"> 532</span>
|
173
|
+
<span class="ansi-green-fg"> 533</span> <span class="ansi-green-intense-fg ansi-bold">return</span> response
|
174
|
+
|
175
|
+
<span class="ansi-green-intense-fg ansi-bold">c:\devtools\python-3.7.9\lib\urllib\request.py</span> in <span class="ansi-cyan-fg">http_response</span><span class="ansi-blue-intense-fg ansi-bold">(self, request, response)</span>
|
176
|
+
<span class="ansi-green-fg"> 639</span> <span class="ansi-green-intense-fg ansi-bold">if</span> <span class="ansi-green-intense-fg ansi-bold">not</span> <span class="ansi-yellow-intense-fg ansi-bold">(</span><span class="ansi-cyan-intense-fg ansi-bold">200</span> <span class="ansi-yellow-intense-fg ansi-bold"><=</span> code <span class="ansi-yellow-intense-fg ansi-bold"><</span> <span class="ansi-cyan-intense-fg ansi-bold">300</span><span class="ansi-yellow-intense-fg ansi-bold">)</span><span class="ansi-yellow-intense-fg ansi-bold">:</span>
|
177
|
+
<span class="ansi-green-fg"> 640</span> response = self.parent.error(
|
178
|
+
<span class="ansi-green-intense-fg ansi-bold">--> 641</span><span class="ansi-yellow-intense-fg ansi-bold"> 'http', request, response, code, msg, hdrs)
|
179
|
+
</span><span class="ansi-green-fg"> 642</span>
|
180
|
+
<span class="ansi-green-fg"> 643</span> <span class="ansi-green-intense-fg ansi-bold">return</span> response
|
181
|
+
|
182
|
+
<span class="ansi-green-intense-fg ansi-bold">c:\devtools\python-3.7.9\lib\urllib\request.py</span> in <span class="ansi-cyan-fg">error</span><span class="ansi-blue-intense-fg ansi-bold">(self, proto, *args)</span>
|
183
|
+
<span class="ansi-green-fg"> 567</span> <span class="ansi-green-intense-fg ansi-bold">if</span> http_err<span class="ansi-yellow-intense-fg ansi-bold">:</span>
|
184
|
+
<span class="ansi-green-fg"> 568</span> args <span class="ansi-yellow-intense-fg ansi-bold">=</span> <span class="ansi-yellow-intense-fg ansi-bold">(</span>dict<span class="ansi-yellow-intense-fg ansi-bold">,</span> <span class="ansi-blue-intense-fg ansi-bold">'default'</span><span class="ansi-yellow-intense-fg ansi-bold">,</span> <span class="ansi-blue-intense-fg ansi-bold">'http_error_default'</span><span class="ansi-yellow-intense-fg ansi-bold">)</span> <span class="ansi-yellow-intense-fg ansi-bold">+</span> orig_args
|
185
|
+
<span class="ansi-green-intense-fg ansi-bold">--> 569</span><span class="ansi-yellow-intense-fg ansi-bold"> </span><span class="ansi-green-intense-fg ansi-bold">return</span> self<span class="ansi-yellow-intense-fg ansi-bold">.</span>_call_chain<span class="ansi-yellow-intense-fg ansi-bold">(</span><span class="ansi-yellow-intense-fg ansi-bold">*</span>args<span class="ansi-yellow-intense-fg ansi-bold">)</span>
|
186
|
+
<span class="ansi-green-fg"> 570</span>
|
187
|
+
<span class="ansi-green-fg"> 571</span> <span class="ansi-red-intense-fg ansi-bold"># XXX probably also want an abstract factory that knows when it makes</span>
|
188
|
+
|
189
|
+
<span class="ansi-green-intense-fg ansi-bold">c:\devtools\python-3.7.9\lib\urllib\request.py</span> in <span class="ansi-cyan-fg">_call_chain</span><span class="ansi-blue-intense-fg ansi-bold">(self, chain, kind, meth_name, *args)</span>
|
190
|
+
<span class="ansi-green-fg"> 501</span> <span class="ansi-green-intense-fg ansi-bold">for</span> handler <span class="ansi-green-intense-fg ansi-bold">in</span> handlers<span class="ansi-yellow-intense-fg ansi-bold">:</span>
|
191
|
+
<span class="ansi-green-fg"> 502</span> func <span class="ansi-yellow-intense-fg ansi-bold">=</span> getattr<span class="ansi-yellow-intense-fg ansi-bold">(</span>handler<span class="ansi-yellow-intense-fg ansi-bold">,</span> meth_name<span class="ansi-yellow-intense-fg ansi-bold">)</span>
|
192
|
+
<span class="ansi-green-intense-fg ansi-bold">--> 503</span><span class="ansi-yellow-intense-fg ansi-bold"> </span>result <span class="ansi-yellow-intense-fg ansi-bold">=</span> func<span class="ansi-yellow-intense-fg ansi-bold">(</span><span class="ansi-yellow-intense-fg ansi-bold">*</span>args<span class="ansi-yellow-intense-fg ansi-bold">)</span>
|
193
|
+
<span class="ansi-green-fg"> 504</span> <span class="ansi-green-intense-fg ansi-bold">if</span> result <span class="ansi-green-intense-fg ansi-bold">is</span> <span class="ansi-green-intense-fg ansi-bold">not</span> <span class="ansi-green-intense-fg ansi-bold">None</span><span class="ansi-yellow-intense-fg ansi-bold">:</span>
|
194
|
+
<span class="ansi-green-fg"> 505</span> <span class="ansi-green-intense-fg ansi-bold">return</span> result
|
195
|
+
|
196
|
+
<span class="ansi-green-intense-fg ansi-bold">c:\devtools\python-3.7.9\lib\urllib\request.py</span> in <span class="ansi-cyan-fg">http_error_default</span><span class="ansi-blue-intense-fg ansi-bold">(self, req, fp, code, msg, hdrs)</span>
|
197
|
+
<span class="ansi-green-fg"> 647</span> <span class="ansi-green-intense-fg ansi-bold">class</span> HTTPDefaultErrorHandler<span class="ansi-yellow-intense-fg ansi-bold">(</span>BaseHandler<span class="ansi-yellow-intense-fg ansi-bold">)</span><span class="ansi-yellow-intense-fg ansi-bold">:</span>
|
198
|
+
<span class="ansi-green-fg"> 648</span> <span class="ansi-green-intense-fg ansi-bold">def</span> http_error_default<span class="ansi-yellow-intense-fg ansi-bold">(</span>self<span class="ansi-yellow-intense-fg ansi-bold">,</span> req<span class="ansi-yellow-intense-fg ansi-bold">,</span> fp<span class="ansi-yellow-intense-fg ansi-bold">,</span> code<span class="ansi-yellow-intense-fg ansi-bold">,</span> msg<span class="ansi-yellow-intense-fg ansi-bold">,</span> hdrs<span class="ansi-yellow-intense-fg ansi-bold">)</span><span class="ansi-yellow-intense-fg ansi-bold">:</span>
|
199
|
+
<span class="ansi-green-intense-fg ansi-bold">--> 649</span><span class="ansi-yellow-intense-fg ansi-bold"> </span><span class="ansi-green-intense-fg ansi-bold">raise</span> HTTPError<span class="ansi-yellow-intense-fg ansi-bold">(</span>req<span class="ansi-yellow-intense-fg ansi-bold">.</span>full_url<span class="ansi-yellow-intense-fg ansi-bold">,</span> code<span class="ansi-yellow-intense-fg ansi-bold">,</span> msg<span class="ansi-yellow-intense-fg ansi-bold">,</span> hdrs<span class="ansi-yellow-intense-fg ansi-bold">,</span> fp<span class="ansi-yellow-intense-fg ansi-bold">)</span>
|
200
|
+
<span class="ansi-green-fg"> 650</span>
|
201
|
+
<span class="ansi-green-fg"> 651</span> <span class="ansi-green-intense-fg ansi-bold">class</span> HTTPRedirectHandler<span class="ansi-yellow-intense-fg ansi-bold">(</span>BaseHandler<span class="ansi-yellow-intense-fg ansi-bold">)</span><span class="ansi-yellow-intense-fg ansi-bold">:</span>
|
202
|
+
|
203
|
+
<span class="ansi-red-intense-fg ansi-bold">HTTPError</span>: HTTP Error 503: Service Unavailable</pre>
|
204
|
+
</div>
|
205
|
+
</div>
|
206
|
+
|
207
|
+
</div>
|
208
|
+
</div>
|
209
|
+
|
210
|
+
</div>
|
211
|
+
|
212
|
+
|
213
|
+
|
214
|
+
<div class="
|
215
|
+
cell border-box-sizing code_cell rendered">
|
216
|
+
<div class="input">
|
217
|
+
|
218
|
+
<div class="inner_cell">
|
219
|
+
<div class="input_area">
|
220
|
+
<div class=" highlight hl-ipython3"><pre><span></span><span class="n">df</span> <span class="o">=</span> <span class="n">pd</span><span class="o">.</span><span class="n">concat</span><span class="p">(</span><span class="n">frames</span><span class="p">)</span>
|
221
|
+
</pre></div>
|
222
|
+
|
223
|
+
</div>
|
224
|
+
</div>
|
225
|
+
</div>
|
226
|
+
|
227
|
+
</div>
|
228
|
+
|
229
|
+
|
230
|
+
|
231
|
+
<div class="
|
232
|
+
cell border-box-sizing code_cell rendered">
|
233
|
+
<div class="input">
|
234
|
+
|
235
|
+
<div class="inner_cell">
|
236
|
+
<div class="input_area">
|
237
|
+
<div class=" highlight hl-ipython3"><pre><span></span><span class="c1"># make it easier to grab the ref</span>
|
238
|
+
<span class="k">def</span> <span class="nf">get_repo</span><span class="p">(</span><span class="n">spec</span><span class="p">):</span>
|
239
|
+
<span class="n">s</span> <span class="o">=</span> <span class="n">spec</span><span class="o">.</span><span class="n">rsplit</span><span class="p">(</span><span class="s2">"/"</span><span class="p">,</span> <span class="mi">1</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span>
|
240
|
+
<span class="k">if</span> <span class="n">s</span><span class="o">.</span><span class="n">endswith</span><span class="p">(</span><span class="s1">'.git'</span><span class="p">):</span>
|
241
|
+
<span class="n">s</span> <span class="o">=</span> <span class="n">s</span><span class="p">[:</span><span class="o">-</span><span class="mi">4</span><span class="p">]</span>
|
242
|
+
<span class="k">return</span> <span class="n">s</span>
|
243
|
+
<span class="n">df</span><span class="p">[</span><span class="s1">'repo'</span><span class="p">]</span> <span class="o">=</span> <span class="n">df</span><span class="p">[</span><span class="s1">'spec'</span><span class="p">]</span><span class="o">.</span><span class="n">apply</span><span class="p">(</span><span class="n">get_repo</span><span class="p">)</span> <span class="c1">#lambda s: s.rsplit("/", 1)[0].replace(".git", ""))</span>
|
244
|
+
<span class="n">df</span><span class="p">[</span><span class="s1">'org'</span><span class="p">]</span> <span class="o">=</span> <span class="n">df</span><span class="p">[</span><span class="s1">'spec'</span><span class="p">]</span><span class="o">.</span><span class="n">apply</span><span class="p">(</span><span class="k">lambda</span> <span class="n">s</span><span class="p">:</span> <span class="n">s</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s2">"/"</span><span class="p">,</span> <span class="mi">1</span><span class="p">)[</span><span class="mi">0</span><span class="p">])</span>
|
245
|
+
<span class="n">df</span><span class="p">[</span><span class="s1">'ref'</span><span class="p">]</span> <span class="o">=</span> <span class="n">df</span><span class="p">[</span><span class="s1">'spec'</span><span class="p">]</span><span class="o">.</span><span class="n">apply</span><span class="p">(</span><span class="k">lambda</span> <span class="n">s</span><span class="p">:</span> <span class="n">s</span><span class="o">.</span><span class="n">rsplit</span><span class="p">(</span><span class="s2">"/"</span><span class="p">,</span> <span class="mi">1</span><span class="p">)[</span><span class="mi">1</span><span class="p">])</span>
|
246
|
+
</pre></div>
|
247
|
+
|
248
|
+
</div>
|
249
|
+
</div>
|
250
|
+
</div>
|
251
|
+
|
252
|
+
</div>
|
253
|
+
|
254
|
+
|
255
|
+
|
256
|
+
<div class="
|
257
|
+
cell border-box-sizing code_cell rendered">
|
258
|
+
<div class="input">
|
259
|
+
|
260
|
+
<div class="inner_cell">
|
261
|
+
<div class="input_area">
|
262
|
+
<div class=" highlight hl-ipython3"><pre><span></span><span class="c1"># take a look at the data, does it look sensible?</span>
|
263
|
+
<span class="n">df</span><span class="o">.</span><span class="n">sample</span><span class="p">(</span><span class="mi">10</span><span class="p">)</span>
|
264
|
+
</pre></div>
|
265
|
+
|
266
|
+
</div>
|
267
|
+
</div>
|
268
|
+
</div>
|
269
|
+
|
270
|
+
</div>
|
271
|
+
|
272
|
+
|
273
|
+
|
274
|
+
<div class="
|
275
|
+
cell border-box-sizing code_cell rendered">
|
276
|
+
<div class="input">
|
277
|
+
|
278
|
+
<div class="inner_cell">
|
279
|
+
<div class="input_area">
|
280
|
+
<div class=" highlight hl-ipython3"><pre><span></span><span class="n">df</span> <span class="o">=</span> <span class="n">df</span><span class="o">.</span><span class="n">drop</span><span class="p">(</span><span class="n">columns</span><span class="o">=</span><span class="p">[</span><span class="s1">'schema'</span><span class="p">,</span> <span class="s1">'version'</span><span class="p">,</span> <span class="s1">'spec'</span><span class="p">,</span> <span class="s1">'status'</span><span class="p">])</span>
|
281
|
+
</pre></div>
|
282
|
+
|
283
|
+
</div>
|
284
|
+
</div>
|
285
|
+
</div>
|
286
|
+
|
287
|
+
</div>
|
288
|
+
|
289
|
+
|
290
|
+
|
291
|
+
<div class="
|
292
|
+
cell border-box-sizing code_cell rendered">
|
293
|
+
<div class="input">
|
294
|
+
|
295
|
+
<div class="inner_cell">
|
296
|
+
<div class="input_area">
|
297
|
+
<div class=" highlight hl-ipython3"><pre><span></span><span class="n">df</span><span class="o">.</span><span class="n">head</span><span class="p">()</span>
|
298
|
+
</pre></div>
|
299
|
+
|
300
|
+
</div>
|
301
|
+
</div>
|
302
|
+
</div>
|
303
|
+
|
304
|
+
</div>
|
305
|
+
<div class="cell border-box-sizing text_cell rendered"><div class="inner_cell">
|
306
|
+
<div class="text_cell_render border-box-sizing rendered_html">
|
307
|
+
<h2 id="Monthly,-weekly,-daily-active-repos">Monthly, weekly, daily active repos<a class="anchor-link" href="#Monthly,-weekly,-daily-active-repos">¶</a></h2>
|
308
|
+
</div>
|
309
|
+
</div>
|
310
|
+
</div>
|
311
|
+
|
312
|
+
|
313
|
+
|
314
|
+
<div class="
|
315
|
+
cell border-box-sizing code_cell rendered">
|
316
|
+
<div class="input">
|
317
|
+
|
318
|
+
<div class="inner_cell">
|
319
|
+
<div class="input_area">
|
320
|
+
<div class=" highlight hl-ipython3"><pre><span></span><span class="n">df_</span> <span class="o">=</span> <span class="n">df</span><span class="o">.</span><span class="n">set_index</span><span class="p">(</span><span class="s2">"timestamp"</span><span class="p">)</span>
|
321
|
+
</pre></div>
|
322
|
+
|
323
|
+
</div>
|
324
|
+
</div>
|
325
|
+
</div>
|
326
|
+
|
327
|
+
</div>
|
328
|
+
|
329
|
+
|
330
|
+
|
331
|
+
<div class="
|
332
|
+
cell border-box-sizing code_cell rendered">
|
333
|
+
<div class="input">
|
334
|
+
|
335
|
+
<div class="inner_cell">
|
336
|
+
<div class="input_area">
|
337
|
+
<div class=" highlight hl-ipython3"><pre><span></span><span class="k">def</span> <span class="nf">n_active_repos</span><span class="p">(</span><span class="n">period</span><span class="o">=</span><span class="mi">30</span><span class="p">):</span>
|
338
|
+
<span class="sd">"""Unique active repos over the period</span>
|
339
|
+
<span class="sd"> </span>
|
340
|
+
<span class="sd"> With period=30 this gives monthly active repos</span>
|
341
|
+
<span class="sd"> With period=1 you get daily active repos</span>
|
342
|
+
<span class="sd"> """</span>
|
343
|
+
<span class="n">now</span> <span class="o">=</span> <span class="n">datetime</span><span class="o">.</span><span class="n">datetime</span><span class="o">.</span><span class="n">now</span><span class="p">()</span>
|
344
|
+
<span class="n">start</span> <span class="o">=</span> <span class="n">datetime</span><span class="o">.</span><span class="n">datetime</span><span class="p">(</span><span class="mi">2019</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span>
|
345
|
+
<span class="n">days_since_start</span> <span class="o">=</span> <span class="p">(</span><span class="n">now</span> <span class="o">-</span> <span class="n">start</span><span class="p">)</span><span class="o">.</span><span class="n">days</span>
|
346
|
+
|
347
|
+
<span class="n">data</span> <span class="o">=</span> <span class="p">[]</span>
|
348
|
+
|
349
|
+
<span class="k">for</span> <span class="n">n</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="n">days_since_start</span><span class="p">):</span>
|
350
|
+
<span class="n">s</span> <span class="o">=</span> <span class="n">start</span> <span class="o">+</span> <span class="n">datetime</span><span class="o">.</span><span class="n">timedelta</span><span class="p">(</span><span class="n">days</span><span class="o">=</span><span class="n">n</span><span class="p">)</span>
|
351
|
+
<span class="n">e</span> <span class="o">=</span> <span class="n">start</span> <span class="o">+</span> <span class="n">datetime</span><span class="o">.</span><span class="n">timedelta</span><span class="p">(</span><span class="n">days</span><span class="o">=</span><span class="n">n</span><span class="o">+</span><span class="n">period</span><span class="p">)</span>
|
352
|
+
<span class="k">if</span> <span class="n">e</span> <span class="o">></span> <span class="n">now</span><span class="p">:</span>
|
353
|
+
<span class="k">break</span>
|
354
|
+
|
355
|
+
<span class="c1"># our "monthly" data</span>
|
356
|
+
<span class="n">monthly</span> <span class="o">=</span> <span class="n">df_</span><span class="o">.</span><span class="n">loc</span><span class="p">[</span><span class="n">s</span><span class="o">.</span><span class="n">isoformat</span><span class="p">():</span><span class="n">e</span><span class="o">.</span><span class="n">isoformat</span><span class="p">()]</span>
|
357
|
+
<span class="n">data</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="nb">dict</span><span class="p">(</span><span class="n">timestamp</span><span class="o">=</span><span class="n">e</span><span class="p">,</span> <span class="n">repos</span><span class="o">=</span><span class="nb">len</span><span class="p">(</span><span class="nb">set</span><span class="p">(</span><span class="n">monthly</span><span class="o">.</span><span class="n">repo</span><span class="p">))))</span>
|
358
|
+
|
359
|
+
<span class="k">return</span> <span class="n">pd</span><span class="o">.</span><span class="n">DataFrame</span><span class="o">.</span><span class="n">from_records</span><span class="p">(</span><span class="n">data</span><span class="p">)</span><span class="o">.</span><span class="n">set_index</span><span class="p">(</span><span class="s2">"timestamp"</span><span class="p">)</span>
|
360
|
+
</pre></div>
|
361
|
+
|
362
|
+
</div>
|
363
|
+
</div>
|
364
|
+
</div>
|
365
|
+
|
366
|
+
</div>
|
367
|
+
|
368
|
+
|
369
|
+
|
370
|
+
<div class="
|
371
|
+
cell border-box-sizing code_cell rendered">
|
372
|
+
<div class="input">
|
373
|
+
|
374
|
+
<div class="inner_cell">
|
375
|
+
<div class="input_area">
|
376
|
+
<div class=" highlight hl-ipython3"><pre><span></span><span class="n">monthly_active</span> <span class="o">=</span> <span class="n">n_active_repos</span><span class="p">(</span><span class="mi">30</span><span class="p">)</span>
|
377
|
+
<span class="n">weekly_active</span> <span class="o">=</span> <span class="n">n_active_repos</span><span class="p">(</span><span class="mi">7</span><span class="p">)</span>
|
378
|
+
<span class="n">daily_active</span> <span class="o">=</span> <span class="n">n_active_repos</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
|
379
|
+
</pre></div>
|
380
|
+
|
381
|
+
</div>
|
382
|
+
</div>
|
383
|
+
</div>
|
384
|
+
|
385
|
+
</div>
|
386
|
+
|
387
|
+
|
388
|
+
|
389
|
+
<div class="
|
390
|
+
cell border-box-sizing code_cell rendered">
|
391
|
+
<div class="input">
|
392
|
+
|
393
|
+
<div class="inner_cell">
|
394
|
+
<div class="input_area">
|
395
|
+
<div class=" highlight hl-ipython3"><pre><span></span><span class="n">activity</span> <span class="o">=</span> <span class="n">pd</span><span class="o">.</span><span class="n">merge</span><span class="p">(</span><span class="n">monthly_active</span><span class="p">,</span> <span class="n">daily_active</span><span class="p">,</span>
|
396
|
+
<span class="n">suffixes</span><span class="o">=</span><span class="p">(</span><span class="s2">"_monthly"</span><span class="p">,</span> <span class="s2">"_daily"</span><span class="p">),</span> <span class="n">left_index</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">right_index</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
|
397
|
+
<span class="n">activity</span> <span class="o">=</span> <span class="n">pd</span><span class="o">.</span><span class="n">merge</span><span class="p">(</span><span class="n">activity</span><span class="p">,</span> <span class="n">weekly_active</span><span class="p">,</span> <span class="n">left_index</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">right_index</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
|
398
|
+
|
399
|
+
<span class="n">activity</span><span class="o">.</span><span class="n">columns</span> <span class="o">=</span> <span class="p">[</span><span class="s1">'30day active'</span><span class="p">,</span> <span class="s1">'1d active'</span><span class="p">,</span> <span class="s1">'7d active'</span><span class="p">]</span>
|
400
|
+
<span class="n">activity</span><span class="o">.</span><span class="n">plot</span><span class="p">();</span>
|
401
|
+
</pre></div>
|
402
|
+
|
403
|
+
</div>
|
404
|
+
</div>
|
405
|
+
</div>
|
406
|
+
|
407
|
+
</div>
|
408
|
+
<div class="cell border-box-sizing text_cell rendered"><div class="inner_cell">
|
409
|
+
<div class="text_cell_render border-box-sizing rendered_html">
|
410
|
+
<h2 id="Total-launches">Total launches<a class="anchor-link" href="#Total-launches">¶</a></h2>
|
411
|
+
</div>
|
412
|
+
</div>
|
413
|
+
</div>
|
414
|
+
|
415
|
+
|
416
|
+
|
417
|
+
<div class="
|
418
|
+
cell border-box-sizing code_cell rendered">
|
419
|
+
<div class="input">
|
420
|
+
|
421
|
+
<div class="inner_cell">
|
422
|
+
<div class="input_area">
|
423
|
+
<div class=" highlight hl-ipython3"><pre><span></span><span class="c1"># Sneak peek: total launches!</span>
|
424
|
+
<span class="n">df</span><span class="o">.</span><span class="n">shape</span>
|
425
|
+
</pre></div>
|
426
|
+
|
427
|
+
</div>
|
428
|
+
</div>
|
429
|
+
</div>
|
430
|
+
|
431
|
+
</div>
|
432
|
+
<div class="cell border-box-sizing text_cell rendered"><div class="inner_cell">
|
433
|
+
<div class="text_cell_render border-box-sizing rendered_html">
|
434
|
+
<h2 id="Launches-per-day">Launches per day<a class="anchor-link" href="#Launches-per-day">¶</a></h2>
|
435
|
+
</div>
|
436
|
+
</div>
|
437
|
+
</div>
|
438
|
+
|
439
|
+
|
440
|
+
|
441
|
+
<div class="
|
442
|
+
cell border-box-sizing code_cell rendered">
|
443
|
+
<div class="input">
|
444
|
+
|
445
|
+
<div class="inner_cell">
|
446
|
+
<div class="input_area">
|
447
|
+
<div class=" highlight hl-ipython3"><pre><span></span><span class="n">daily</span> <span class="o">=</span> <span class="n">df</span><span class="o">.</span><span class="n">set_index</span><span class="p">(</span><span class="s2">"timestamp"</span><span class="p">)</span><span class="o">.</span><span class="n">resample</span><span class="p">(</span><span class="s1">'D'</span><span class="p">)</span><span class="o">.</span><span class="n">count</span><span class="p">()</span>
|
448
|
+
</pre></div>
|
449
|
+
|
450
|
+
</div>
|
451
|
+
</div>
|
452
|
+
</div>
|
453
|
+
|
454
|
+
</div>
|
455
|
+
|
456
|
+
|
457
|
+
|
458
|
+
<div class="
|
459
|
+
cell border-box-sizing code_cell rendered">
|
460
|
+
<div class="input">
|
461
|
+
|
462
|
+
<div class="inner_cell">
|
463
|
+
<div class="input_area">
|
464
|
+
<div class=" highlight hl-ipython3"><pre><span></span><span class="n">daily</span><span class="p">[</span><span class="s1">'repo'</span><span class="p">]</span><span class="o">.</span><span class="n">plot</span><span class="p">()</span>
|
465
|
+
</pre></div>
|
466
|
+
|
467
|
+
</div>
|
468
|
+
</div>
|
469
|
+
</div>
|
470
|
+
|
471
|
+
</div>
|
472
|
+
<div class="cell border-box-sizing text_cell rendered"><div class="inner_cell">
|
473
|
+
<div class="text_cell_render border-box-sizing rendered_html">
|
474
|
+
<h2 id="Estimate-number-of-unique-repositories">Estimate number of unique repositories<a class="anchor-link" href="#Estimate-number-of-unique-repositories">¶</a></h2><p>Expect the raw number of launches to be bigger than the number of repositories launched more than once. Those launched only once might have been accidents.</p>
|
475
|
+
|
476
|
+
</div>
|
477
|
+
</div>
|
478
|
+
</div>
|
479
|
+
|
480
|
+
|
481
|
+
|
482
|
+
<div class="
|
483
|
+
cell border-box-sizing code_cell rendered">
|
484
|
+
<div class="input">
|
485
|
+
|
486
|
+
<div class="inner_cell">
|
487
|
+
<div class="input_area">
|
488
|
+
<div class=" highlight hl-ipython3"><pre><span></span><span class="nb">len</span><span class="p">(</span><span class="nb">set</span><span class="p">(</span><span class="n">df</span><span class="o">.</span><span class="n">repo</span><span class="p">))</span>
|
489
|
+
</pre></div>
|
490
|
+
|
491
|
+
</div>
|
492
|
+
</div>
|
493
|
+
</div>
|
494
|
+
|
495
|
+
</div>
|
496
|
+
|
497
|
+
|
498
|
+
|
499
|
+
<div class="
|
500
|
+
cell border-box-sizing code_cell rendered">
|
501
|
+
<div class="input">
|
502
|
+
|
503
|
+
<div class="inner_cell">
|
504
|
+
<div class="input_area">
|
505
|
+
<div class=" highlight hl-ipython3"><pre><span></span><span class="kn">from</span> <span class="nn">collections</span> <span class="kn">import</span> <span class="n">Counter</span>
|
506
|
+
|
507
|
+
<span class="nb">sum</span><span class="p">(</span><span class="mi">1</span> <span class="k">for</span> <span class="n">k</span><span class="p">,</span><span class="n">v</span> <span class="ow">in</span> <span class="n">Counter</span><span class="p">(</span><span class="n">df</span><span class="o">.</span><span class="n">repo</span><span class="p">)</span><span class="o">.</span><span class="n">items</span><span class="p">()</span> <span class="k">if</span> <span class="n">v</span> <span class="o">></span> <span class="mi">3</span><span class="p">)</span>
|
508
|
+
</pre></div>
|
509
|
+
|
510
|
+
</div>
|
511
|
+
</div>
|
512
|
+
</div>
|
513
|
+
|
514
|
+
</div>
|
515
|
+
<div class="cell border-box-sizing text_cell rendered"><div class="inner_cell">
|
516
|
+
<div class="text_cell_render border-box-sizing rendered_html">
|
517
|
+
<h2 id="Popular-repositories-and-their-branches">Popular repositories and their branches<a class="anchor-link" href="#Popular-repositories-and-their-branches">¶</a></h2><p>Twenty most popular repos:</p>
|
518
|
+
|
519
|
+
</div>
|
520
|
+
</div>
|
521
|
+
</div>
|
522
|
+
|
523
|
+
|
524
|
+
|
525
|
+
<div class="
|
526
|
+
cell border-box-sizing code_cell rendered">
|
527
|
+
<div class="input">
|
528
|
+
|
529
|
+
<div class="inner_cell">
|
530
|
+
<div class="input_area">
|
531
|
+
<div class=" highlight hl-ipython3"><pre><span></span><span class="n">top20</span> <span class="o">=</span> <span class="n">df</span><span class="o">.</span><span class="n">groupby</span><span class="p">(</span><span class="s2">"repo"</span><span class="p">)</span><span class="o">.</span><span class="n">count</span><span class="p">()</span><span class="o">.</span><span class="n">sort_values</span><span class="p">(</span><span class="s2">"timestamp"</span><span class="p">,</span> <span class="n">ascending</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span><span class="o">.</span><span class="n">head</span><span class="p">(</span><span class="mi">20</span><span class="p">)</span>
|
532
|
+
<span class="n">top20</span>
|
533
|
+
</pre></div>
|
534
|
+
|
535
|
+
</div>
|
536
|
+
</div>
|
537
|
+
</div>
|
538
|
+
|
539
|
+
</div>
|
540
|
+
|
541
|
+
|
542
|
+
|
543
|
+
<div class="
|
544
|
+
cell border-box-sizing code_cell rendered">
|
545
|
+
<div class="input">
|
546
|
+
|
547
|
+
<div class="inner_cell">
|
548
|
+
<div class="input_area">
|
549
|
+
<div class=" highlight hl-ipython3"><pre><span></span><span class="nb">print</span><span class="p">(</span><span class="s2">"Cumulative top20 launches:"</span><span class="p">,</span> <span class="n">top20</span><span class="p">[</span><span class="s1">'ref'</span><span class="p">]</span><span class="o">.</span><span class="n">sum</span><span class="p">())</span>
|
550
|
+
<span class="nb">print</span><span class="p">(</span><span class="s2">"The top20 repos are </span><span class="si">{:.1f}% o</span><span class="s2">f all "</span>
|
551
|
+
<span class="s2">"launches."</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="mi">100</span> <span class="o">*</span> <span class="n">top20</span><span class="p">[</span><span class="s1">'ref'</span><span class="p">]</span><span class="o">.</span><span class="n">sum</span><span class="p">()</span> <span class="o">/</span> <span class="n">df</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">0</span><span class="p">]))</span>
|
552
|
+
</pre></div>
|
553
|
+
|
554
|
+
</div>
|
555
|
+
</div>
|
556
|
+
</div>
|
557
|
+
|
558
|
+
</div>
|
559
|
+
<div class="cell border-box-sizing text_cell rendered"><div class="inner_cell">
|
560
|
+
<div class="text_cell_render border-box-sizing rendered_html">
|
561
|
+
<h2 id="Per-org-stats">Per org stats<a class="anchor-link" href="#Per-org-stats">¶</a></h2><p>Needs more RAM than mybinder.org gives us for now</p>
|
562
|
+
|
563
|
+
</div>
|
564
|
+
</div>
|
565
|
+
</div>
|
566
|
+
|
567
|
+
|
568
|
+
|
569
|
+
<div class="
|
570
|
+
cell border-box-sizing code_cell rendered">
|
571
|
+
<div class="input">
|
572
|
+
|
573
|
+
<div class="inner_cell">
|
574
|
+
<div class="input_area">
|
575
|
+
<div class=" highlight hl-ipython3"><pre><span></span><span class="c1"># add a new column showing total launches per repo</span>
|
576
|
+
<span class="n">totals_per_repo</span> <span class="o">=</span> <span class="p">(</span><span class="n">df</span><span class="o">.</span><span class="n">groupby</span><span class="p">([</span><span class="s2">"repo"</span><span class="p">])</span>
|
577
|
+
<span class="o">.</span><span class="n">size</span><span class="p">()</span>
|
578
|
+
<span class="o">.</span><span class="n">reset_index</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="s1">'repo_counts'</span><span class="p">))</span>
|
579
|
+
</pre></div>
|
580
|
+
|
581
|
+
</div>
|
582
|
+
</div>
|
583
|
+
</div>
|
584
|
+
|
585
|
+
</div>
|
586
|
+
|
587
|
+
|
588
|
+
|
589
|
+
<div class="
|
590
|
+
cell border-box-sizing code_cell rendered">
|
591
|
+
<div class="input">
|
592
|
+
|
593
|
+
<div class="inner_cell">
|
594
|
+
<div class="input_area">
|
595
|
+
<div class=" highlight hl-ipython3"><pre><span></span><span class="c1"># add a nnew column showing total launches per org</span>
|
596
|
+
<span class="n">totals_per_org</span> <span class="o">=</span> <span class="p">(</span><span class="n">df</span><span class="o">.</span><span class="n">groupby</span><span class="p">([</span><span class="s2">"org"</span><span class="p">])</span>
|
597
|
+
<span class="o">.</span><span class="n">size</span><span class="p">()</span>
|
598
|
+
<span class="o">.</span><span class="n">reset_index</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="s1">'org_counts'</span><span class="p">))</span>
|
599
|
+
</pre></div>
|
600
|
+
|
601
|
+
</div>
|
602
|
+
</div>
|
603
|
+
</div>
|
604
|
+
|
605
|
+
</div>
|
606
|
+
|
607
|
+
|
608
|
+
|
609
|
+
<div class="
|
610
|
+
cell border-box-sizing code_cell rendered">
|
611
|
+
<div class="input">
|
612
|
+
|
613
|
+
<div class="inner_cell">
|
614
|
+
<div class="input_area">
|
615
|
+
<div class=" highlight hl-ipython3"><pre><span></span><span class="n">df_</span> <span class="o">=</span> <span class="n">pd</span><span class="o">.</span><span class="n">merge</span><span class="p">(</span><span class="n">df</span><span class="p">,</span> <span class="n">totals_per_repo</span><span class="p">,</span> <span class="n">on</span><span class="o">=</span><span class="s1">'repo'</span><span class="p">)</span>
|
616
|
+
<span class="n">df_</span> <span class="o">=</span> <span class="n">pd</span><span class="o">.</span><span class="n">merge</span><span class="p">(</span><span class="n">df_</span><span class="p">,</span> <span class="n">totals_per_org</span><span class="p">,</span> <span class="n">on</span><span class="o">=</span><span class="s1">'org'</span><span class="p">)</span>
|
617
|
+
<span class="c1">#df_.sample(10)</span>
|
618
|
+
</pre></div>
|
619
|
+
|
620
|
+
</div>
|
621
|
+
</div>
|
622
|
+
</div>
|
623
|
+
|
624
|
+
</div>
|
625
|
+
|
626
|
+
|
627
|
+
|
628
|
+
<div class="
|
629
|
+
cell border-box-sizing code_cell rendered">
|
630
|
+
<div class="input">
|
631
|
+
|
632
|
+
<div class="inner_cell">
|
633
|
+
<div class="input_area">
|
634
|
+
<div class=" highlight hl-ipython3"><pre><span></span><span class="p">(</span><span class="n">df</span><span class="o">.</span><span class="n">groupby</span><span class="p">(</span><span class="s2">"provider"</span><span class="p">)</span>
|
635
|
+
<span class="o">.</span><span class="n">size</span><span class="p">()</span>
|
636
|
+
<span class="o">.</span><span class="n">reset_index</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="s1">'Launches'</span><span class="p">)</span>
|
637
|
+
<span class="o">.</span><span class="n">sort_values</span><span class="p">(</span><span class="s1">'Launches'</span><span class="p">,</span> <span class="n">ascending</span><span class="o">=</span><span class="kc">False</span><span class="p">))</span>
|
638
|
+
</pre></div>
|
639
|
+
|
640
|
+
</div>
|
641
|
+
</div>
|
642
|
+
</div>
|
643
|
+
|
644
|
+
</div>
|
645
|
+
|
646
|
+
|
647
|
+
|
648
|
+
<div class="
|
649
|
+
cell border-box-sizing code_cell rendered">
|
650
|
+
<div class="input">
|
651
|
+
|
652
|
+
<div class="inner_cell">
|
653
|
+
<div class="input_area">
|
654
|
+
<div class=" highlight hl-ipython3"><pre><span></span><span class="p">(</span><span class="n">df_</span><span class="o">.</span><span class="n">groupby</span><span class="p">([</span><span class="s2">"org"</span><span class="p">,</span> <span class="s2">"repo"</span><span class="p">,</span> <span class="s2">"ref"</span><span class="p">,</span> <span class="s2">"repo_counts"</span><span class="p">,</span> <span class="s2">"org_counts"</span><span class="p">])</span>
|
655
|
+
<span class="o">.</span><span class="n">size</span><span class="p">()</span>
|
656
|
+
<span class="c1"># give the column a nice name</span>
|
657
|
+
<span class="o">.</span><span class="n">reset_index</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="s1">'ref_counts'</span><span class="p">)</span>
|
658
|
+
<span class="c1"># sort first by total launches, then within a repo by ref launches</span>
|
659
|
+
<span class="o">.</span><span class="n">sort_values</span><span class="p">([</span><span class="s1">'org_counts'</span><span class="p">,</span> <span class="s1">'repo_counts'</span><span class="p">,</span> <span class="s1">'ref_counts'</span><span class="p">],</span>
|
660
|
+
<span class="n">ascending</span><span class="o">=</span><span class="p">[</span><span class="kc">False</span><span class="p">,</span><span class="kc">False</span><span class="p">,</span> <span class="kc">False</span><span class="p">])</span>
|
661
|
+
<span class="o">.</span><span class="n">set_index</span><span class="p">([</span><span class="s2">"org"</span><span class="p">,</span> <span class="s1">'repo'</span><span class="p">,</span> <span class="s1">'ref'</span><span class="p">])</span>
|
662
|
+
<span class="p">)</span>
|
663
|
+
</pre></div>
|
664
|
+
|
665
|
+
</div>
|
666
|
+
</div>
|
667
|
+
</div>
|
668
|
+
|
669
|
+
</div>
|
670
|
+
|