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.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/_includes/themes/j1/blocks/footer/boxes/contacts_box.proc +46 -18
  3. data/_includes/themes/j1/blocks/footer/boxes/links_box.proc +1 -0
  4. data/assets/data/fab.html +2 -2
  5. data/assets/data/footer.html +2 -2
  6. data/assets/themes/j1/core/css/themes/unolight/bootstrap.css +64 -206
  7. data/assets/themes/j1/core/css/themes/unolight/bootstrap.min.css +2 -2
  8. data/assets/themes/j1/modules/nbInteract/README.md +169 -0
  9. data/assets/themes/j1/modules/nbInteract/css/nbinteract-core.css +4 -0
  10. data/assets/themes/j1/modules/nbInteract/css/nbinteract-core.min.css +4 -0
  11. data/lib/j1/version.rb +1 -1
  12. data/lib/starter_web/Gemfile +1 -1
  13. data/lib/starter_web/_config.yml +1 -1
  14. data/lib/starter_web/_data/blocks/defaults/footer.yml +25 -17
  15. data/lib/starter_web/_data/blocks/footer.yml +78 -65
  16. data/lib/starter_web/_data/resources.yml +0 -22
  17. data/lib/starter_web/_includes/attributes.asciidoc +14 -0
  18. data/lib/starter_web/_plugins/lunr_index.rb +1 -1
  19. data/lib/starter_web/assets/images/pages/nbinteract/nbi-textbook-example.jpg +0 -0
  20. data/lib/starter_web/package.json +1 -1
  21. data/lib/starter_web/pages/public/jupyter/docs/_includes/documents/j1_docs_example_static.asciidoc +232 -232
  22. data/lib/starter_web/pages/public/jupyter/docs/j1-nbinteract-doc.adoc +135 -134
  23. data/lib/starter_web/pages/public/jupyter/docs/nbi-widget-manual.adoc +2 -4
  24. data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_interactive_widgets-checkpoint.ipynb +170 -15
  25. data/lib/starter_web/pages/public/jupyter/notebooks/j1/j1_interactive_widgets.ipynb +170 -15
  26. data/lib/starter_web/pages/public/jupyter/notebooks/nbi-docs/.ipynb_checkpoints/nbi_docs_recipes_interactive_questions-checkpoint.ipynb +185 -0
  27. data/lib/starter_web/pages/public/jupyter/notebooks/nbi-docs/nbi_docs_recipes_interactive_questions.ipynb +19 -22
  28. data/lib/starter_web/pages/public/jupyter/notebooks/textbooks/binder-launches.html +670 -546
  29. data/lib/starter_web/pages/public/jupyter/notebooks/textbooks/j1_docs_example_dynamic.html +186 -186
  30. data/lib/starter_web/pages/public/jupyter/notebooks/textbooks/j1_interactive_widgets.html +919 -702
  31. data/lib/starter_web/pages/public/jupyter/notebooks/textbooks/j1_ode_selected.html +186 -186
  32. data/lib/starter_web/pages/public/jupyter/notebooks/textbooks/nbi_docs_recipes_interactive_questions.html +242 -243
  33. data/lib/starter_web/pages/public/jupyter/{apis/binderhub-api.adoc → services/binderhub.adoc} +22 -25
  34. data/lib/starter_web/pages/public/jupyter/{apis/jupyterhub-api.adoc → services/jupyterhub.adoc} +2 -2
  35. data/lib/starter_web/pages/public/learn/roundtrip/300_icon_fonts.adoc +11 -0
  36. data/lib/starter_web/utilsrv/_defaults/package.json +1 -1
  37. data/lib/starter_web/utilsrv/package.json +1 -1
  38. metadata +7 -28
  39. data/lib/starter_web/_data/_resources.yml +0 -1668
  40. data/lib/starter_web/assets/images/pages/nbinteract/binderhub-architecture.png +0 -0
  41. data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/algebra_with_sympy-checkpoint.ipynb +0 -14488
  42. data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/climate-change-forecast-checkpoint.ipynb +0 -916
  43. data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/ipympl_test_plots-checkpoint.ipynb +0 -14517
  44. data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_algebra_with_sympy-checkpoint.ipynb +0 -14517
  45. data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_altair_interactive-checkpoint.ipynb +0 -16493
  46. data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_altair_visualization-checkpoint.ipynb +0 -15358
  47. data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_altair_visualization_full-checkpoint.ipynb +0 -2576
  48. data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_climate_change_forecast-checkpoint.ipynb +0 -1058
  49. data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_climate_change_forecast.ipynb +0 -1060
  50. data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_docs_example_dynamic-checkpoint.ipynb +0 -14478
  51. data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_docs_hist-checkpoint.ipynb +0 -98
  52. data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_interactive-checkpoint.ipynb +0 -560
  53. data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_ipympl_test_plots-checkpoint.ipynb +0 -14511
  54. data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_ode_selected-checkpoint.ipynb +0 -14478
  55. data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_odes_in_python-checkpoint.ipynb +0 -14818
  56. data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_pandas_creating_reading_and_writing-checkpoint.ipynb +0 -328
  57. data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_recipes_layout-checkpoint.ipynb +0 -341
  58. data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/nbi_docs_recipes_graphing-checkpoint.ipynb +0 -98
  59. data/lib/starter_web/pages/public/jupyter/notebooks/nbi-docs/.ipynb_checkpoints/nbi_docs_examples_correlation-checkpoint.ipynb +0 -651
  60. data/lib/starter_web/pages/public/jupyter/notebooks/nbi-docs/.ipynb_checkpoints/nbi_docs_examples_variability_of_the_sample_mean-checkpoint.ipynb +0 -323
  61. data/lib/starter_web/pages/public/jupyter/notebooks/nbi-docs/.ipynb_checkpoints/nbi_docs_recipes_graphing-checkpoint.ipynb +0 -387
  62. 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">&#182;</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">&quot;https://archive.analytics.mybinder.org/index.jsonl&quot;</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">&quot;https://archive.analytics.mybinder.org/</span><span class="si">{}</span><span class="s2">&quot;</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">&#39;name&#39;</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">&gt;</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">&quot;Fetched data for </span><span class="si">{</span><span class="n">n</span><span class="si">}</span><span class="s2"> days.&quot;</span><span class="p">)</span>
80
- </pre></div>
81
-
82
- </div>
83
- </div>
84
- </div>
85
-
86
- </div>
87
-
88
-
89
-
90
- <div class="
91
- cell border-box-sizing code_cell rendered">
92
- <div class="input">
93
-
94
- <div class="inner_cell">
95
- <div class="input_area">
96
- <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>
97
- </pre></div>
98
-
99
- </div>
100
- </div>
101
- </div>
102
-
103
- </div>
104
-
105
-
106
-
107
- <div class="
108
- cell border-box-sizing code_cell rendered">
109
- <div class="input">
110
-
111
- <div class="inner_cell">
112
- <div class="input_area">
113
- <div class=" highlight hl-ipython3"><pre><span></span><span class="c1"># make it easier to grab the ref</span>
114
- <span class="k">def</span> <span class="nf">get_repo</span><span class="p">(</span><span class="n">spec</span><span class="p">):</span>
115
- <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">&quot;/&quot;</span><span class="p">,</span> <span class="mi">1</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span>
116
- <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">&#39;.git&#39;</span><span class="p">):</span>
117
- <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>
118
- <span class="k">return</span> <span class="n">s</span>
119
- <span class="n">df</span><span class="p">[</span><span class="s1">&#39;repo&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">df</span><span class="p">[</span><span class="s1">&#39;spec&#39;</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(&quot;/&quot;, 1)[0].replace(&quot;.git&quot;, &quot;&quot;))</span>
120
- <span class="n">df</span><span class="p">[</span><span class="s1">&#39;org&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">df</span><span class="p">[</span><span class="s1">&#39;spec&#39;</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">&quot;/&quot;</span><span class="p">,</span> <span class="mi">1</span><span class="p">)[</span><span class="mi">0</span><span class="p">])</span>
121
- <span class="n">df</span><span class="p">[</span><span class="s1">&#39;ref&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">df</span><span class="p">[</span><span class="s1">&#39;spec&#39;</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">&quot;/&quot;</span><span class="p">,</span> <span class="mi">1</span><span class="p">)[</span><span class="mi">1</span><span class="p">])</span>
122
- </pre></div>
123
-
124
- </div>
125
- </div>
126
- </div>
127
-
128
- </div>
129
-
130
-
131
-
132
- <div class="
133
- cell border-box-sizing code_cell rendered">
134
- <div class="input">
135
-
136
- <div class="inner_cell">
137
- <div class="input_area">
138
- <div class=" highlight hl-ipython3"><pre><span></span><span class="c1"># take a look at the data, does it look sensible?</span>
139
- <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>
140
- </pre></div>
141
-
142
- </div>
143
- </div>
144
- </div>
145
-
146
- </div>
147
-
148
-
149
-
150
- <div class="
151
- cell border-box-sizing code_cell rendered">
152
- <div class="input">
153
-
154
- <div class="inner_cell">
155
- <div class="input_area">
156
- <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">&#39;schema&#39;</span><span class="p">,</span> <span class="s1">&#39;version&#39;</span><span class="p">,</span> <span class="s1">&#39;spec&#39;</span><span class="p">,</span> <span class="s1">&#39;status&#39;</span><span class="p">])</span>
157
- </pre></div>
158
-
159
- </div>
160
- </div>
161
- </div>
162
-
163
- </div>
164
-
165
-
166
-
167
- <div class="
168
- cell border-box-sizing code_cell rendered">
169
- <div class="input">
170
-
171
- <div class="inner_cell">
172
- <div class="input_area">
173
- <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>
174
- </pre></div>
175
-
176
- </div>
177
- </div>
178
- </div>
179
-
180
- </div>
181
- <div class="cell border-box-sizing text_cell rendered"><div class="inner_cell">
182
- <div class="text_cell_render border-box-sizing rendered_html">
183
- <h2 id="Monthly,-weekly,-daily-active-repos">Monthly, weekly, daily active repos<a class="anchor-link" href="#Monthly,-weekly,-daily-active-repos">&#182;</a></h2>
184
- </div>
185
- </div>
186
- </div>
187
-
188
-
189
-
190
- <div class="
191
- cell border-box-sizing code_cell rendered">
192
- <div class="input">
193
-
194
- <div class="inner_cell">
195
- <div class="input_area">
196
- <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">&quot;timestamp&quot;</span><span class="p">)</span>
197
- </pre></div>
198
-
199
- </div>
200
- </div>
201
- </div>
202
-
203
- </div>
204
-
205
-
206
-
207
- <div class="
208
- cell border-box-sizing code_cell rendered">
209
- <div class="input">
210
-
211
- <div class="inner_cell">
212
- <div class="input_area">
213
- <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>
214
- <span class="sd">&quot;&quot;&quot;Unique active repos over the period</span>
215
- <span class="sd"> </span>
216
- <span class="sd"> With period=30 this gives monthly active repos</span>
217
- <span class="sd"> With period=1 you get daily active repos</span>
218
- <span class="sd"> &quot;&quot;&quot;</span>
219
- <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>
220
- <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>
221
- <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>
222
-
223
- <span class="n">data</span> <span class="o">=</span> <span class="p">[]</span>
224
-
225
- <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>
226
- <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>
227
- <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>
228
- <span class="k">if</span> <span class="n">e</span> <span class="o">&gt;</span> <span class="n">now</span><span class="p">:</span>
229
- <span class="k">break</span>
230
-
231
- <span class="c1"># our &quot;monthly&quot; data</span>
232
- <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>
233
- <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>
234
-
235
- <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">&quot;timestamp&quot;</span><span class="p">)</span>
236
- </pre></div>
237
-
238
- </div>
239
- </div>
240
- </div>
241
-
242
- </div>
243
-
244
-
245
-
246
- <div class="
247
- cell border-box-sizing code_cell rendered">
248
- <div class="input">
249
-
250
- <div class="inner_cell">
251
- <div class="input_area">
252
- <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>
253
- <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>
254
- <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>
255
- </pre></div>
256
-
257
- </div>
258
- </div>
259
- </div>
260
-
261
- </div>
262
-
263
-
264
-
265
- <div class="
266
- cell border-box-sizing code_cell rendered">
267
- <div class="input">
268
-
269
- <div class="inner_cell">
270
- <div class="input_area">
271
- <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>
272
- <span class="n">suffixes</span><span class="o">=</span><span class="p">(</span><span class="s2">&quot;_monthly&quot;</span><span class="p">,</span> <span class="s2">&quot;_daily&quot;</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>
273
- <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>
274
-
275
- <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">&#39;30day active&#39;</span><span class="p">,</span> <span class="s1">&#39;1d active&#39;</span><span class="p">,</span> <span class="s1">&#39;7d active&#39;</span><span class="p">]</span>
276
- <span class="n">activity</span><span class="o">.</span><span class="n">plot</span><span class="p">();</span>
277
- </pre></div>
278
-
279
- </div>
280
- </div>
281
- </div>
282
-
283
- </div>
284
- <div class="cell border-box-sizing text_cell rendered"><div class="inner_cell">
285
- <div class="text_cell_render border-box-sizing rendered_html">
286
- <h2 id="Total-launches">Total launches<a class="anchor-link" href="#Total-launches">&#182;</a></h2>
287
- </div>
288
- </div>
289
- </div>
290
-
291
-
292
-
293
- <div class="
294
- cell border-box-sizing code_cell rendered">
295
- <div class="input">
296
-
297
- <div class="inner_cell">
298
- <div class="input_area">
299
- <div class=" highlight hl-ipython3"><pre><span></span><span class="c1"># Sneak peek: total launches!</span>
300
- <span class="n">df</span><span class="o">.</span><span class="n">shape</span>
301
- </pre></div>
302
-
303
- </div>
304
- </div>
305
- </div>
306
-
307
- </div>
308
- <div class="cell border-box-sizing text_cell rendered"><div class="inner_cell">
309
- <div class="text_cell_render border-box-sizing rendered_html">
310
- <h2 id="Launches-per-day">Launches per day<a class="anchor-link" href="#Launches-per-day">&#182;</a></h2>
311
- </div>
312
- </div>
313
- </div>
314
-
315
-
316
-
317
- <div class="
318
- cell border-box-sizing code_cell rendered">
319
- <div class="input">
320
-
321
- <div class="inner_cell">
322
- <div class="input_area">
323
- <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">&quot;timestamp&quot;</span><span class="p">)</span><span class="o">.</span><span class="n">resample</span><span class="p">(</span><span class="s1">&#39;D&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">count</span><span class="p">()</span>
324
- </pre></div>
325
-
326
- </div>
327
- </div>
328
- </div>
329
-
330
- </div>
331
-
332
-
333
-
334
- <div class="
335
- cell border-box-sizing code_cell rendered">
336
- <div class="input">
337
-
338
- <div class="inner_cell">
339
- <div class="input_area">
340
- <div class=" highlight hl-ipython3"><pre><span></span><span class="n">daily</span><span class="p">[</span><span class="s1">&#39;repo&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">plot</span><span class="p">()</span>
341
- </pre></div>
342
-
343
- </div>
344
- </div>
345
- </div>
346
-
347
- </div>
348
- <div class="cell border-box-sizing text_cell rendered"><div class="inner_cell">
349
- <div class="text_cell_render border-box-sizing rendered_html">
350
- <h2 id="Estimate-number-of-unique-repositories">Estimate number of unique repositories<a class="anchor-link" href="#Estimate-number-of-unique-repositories">&#182;</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>
351
-
352
- </div>
353
- </div>
354
- </div>
355
-
356
-
357
-
358
- <div class="
359
- cell border-box-sizing code_cell rendered">
360
- <div class="input">
361
-
362
- <div class="inner_cell">
363
- <div class="input_area">
364
- <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>
365
- </pre></div>
366
-
367
- </div>
368
- </div>
369
- </div>
370
-
371
- </div>
372
-
373
-
374
-
375
- <div class="
376
- cell border-box-sizing code_cell rendered">
377
- <div class="input">
378
-
379
- <div class="inner_cell">
380
- <div class="input_area">
381
- <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>
382
-
383
- <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">&gt;</span> <span class="mi">3</span><span class="p">)</span>
384
- </pre></div>
385
-
386
- </div>
387
- </div>
388
- </div>
389
-
390
- </div>
391
- <div class="cell border-box-sizing text_cell rendered"><div class="inner_cell">
392
- <div class="text_cell_render border-box-sizing rendered_html">
393
- <h2 id="Popular-repositories-and-their-branches">Popular repositories and their branches<a class="anchor-link" href="#Popular-repositories-and-their-branches">&#182;</a></h2><p>Twenty most popular repos:</p>
394
-
395
- </div>
396
- </div>
397
- </div>
398
-
399
-
400
-
401
- <div class="
402
- cell border-box-sizing code_cell rendered">
403
- <div class="input">
404
-
405
- <div class="inner_cell">
406
- <div class="input_area">
407
- <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">&quot;repo&quot;</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">&quot;timestamp&quot;</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>
408
- <span class="n">top20</span>
409
- </pre></div>
410
-
411
- </div>
412
- </div>
413
- </div>
414
-
415
- </div>
416
-
417
-
418
-
419
- <div class="
420
- cell border-box-sizing code_cell rendered">
421
- <div class="input">
422
-
423
- <div class="inner_cell">
424
- <div class="input_area">
425
- <div class=" highlight hl-ipython3"><pre><span></span><span class="nb">print</span><span class="p">(</span><span class="s2">&quot;Cumulative top20 launches:&quot;</span><span class="p">,</span> <span class="n">top20</span><span class="p">[</span><span class="s1">&#39;ref&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">sum</span><span class="p">())</span>
426
- <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;The top20 repos are </span><span class="si">{:.1f}% o</span><span class="s2">f all &quot;</span>
427
- <span class="s2">&quot;launches.&quot;</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">&#39;ref&#39;</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>
428
- </pre></div>
429
-
430
- </div>
431
- </div>
432
- </div>
433
-
434
- </div>
435
- <div class="cell border-box-sizing text_cell rendered"><div class="inner_cell">
436
- <div class="text_cell_render border-box-sizing rendered_html">
437
- <h2 id="Per-org-stats">Per org stats<a class="anchor-link" href="#Per-org-stats">&#182;</a></h2><p>Needs more RAM than mybinder.org gives us for now</p>
438
-
439
- </div>
440
- </div>
441
- </div>
442
-
443
-
444
-
445
- <div class="
446
- cell border-box-sizing code_cell rendered">
447
- <div class="input">
448
-
449
- <div class="inner_cell">
450
- <div class="input_area">
451
- <div class=" highlight hl-ipython3"><pre><span></span><span class="c1"># add a new column showing total launches per repo</span>
452
- <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">&quot;repo&quot;</span><span class="p">])</span>
453
- <span class="o">.</span><span class="n">size</span><span class="p">()</span>
454
- <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">&#39;repo_counts&#39;</span><span class="p">))</span>
455
- </pre></div>
456
-
457
- </div>
458
- </div>
459
- </div>
460
-
461
- </div>
462
-
463
-
464
-
465
- <div class="
466
- cell border-box-sizing code_cell rendered">
467
- <div class="input">
468
-
469
- <div class="inner_cell">
470
- <div class="input_area">
471
- <div class=" highlight hl-ipython3"><pre><span></span><span class="c1"># add a nnew column showing total launches per org</span>
472
- <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">&quot;org&quot;</span><span class="p">])</span>
473
- <span class="o">.</span><span class="n">size</span><span class="p">()</span>
474
- <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">&#39;org_counts&#39;</span><span class="p">))</span>
475
- </pre></div>
476
-
477
- </div>
478
- </div>
479
- </div>
480
-
481
- </div>
482
-
483
-
484
-
485
- <div class="
486
- cell border-box-sizing code_cell rendered">
487
- <div class="input">
488
-
489
- <div class="inner_cell">
490
- <div class="input_area">
491
- <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">&#39;repo&#39;</span><span class="p">)</span>
492
- <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">&#39;org&#39;</span><span class="p">)</span>
493
- <span class="c1">#df_.sample(10)</span>
494
- </pre></div>
495
-
496
- </div>
497
- </div>
498
- </div>
499
-
500
- </div>
501
-
502
-
503
-
504
- <div class="
505
- cell border-box-sizing code_cell rendered">
506
- <div class="input">
507
-
508
- <div class="inner_cell">
509
- <div class="input_area">
510
- <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">&quot;provider&quot;</span><span class="p">)</span>
511
- <span class="o">.</span><span class="n">size</span><span class="p">()</span>
512
- <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">&#39;Launches&#39;</span><span class="p">)</span>
513
- <span class="o">.</span><span class="n">sort_values</span><span class="p">(</span><span class="s1">&#39;Launches&#39;</span><span class="p">,</span> <span class="n">ascending</span><span class="o">=</span><span class="kc">False</span><span class="p">))</span>
514
- </pre></div>
515
-
516
- </div>
517
- </div>
518
- </div>
519
-
520
- </div>
521
-
522
-
523
-
524
- <div class="
525
- cell border-box-sizing code_cell rendered">
526
- <div class="input">
527
-
528
- <div class="inner_cell">
529
- <div class="input_area">
530
- <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">&quot;org&quot;</span><span class="p">,</span> <span class="s2">&quot;repo&quot;</span><span class="p">,</span> <span class="s2">&quot;ref&quot;</span><span class="p">,</span> <span class="s2">&quot;repo_counts&quot;</span><span class="p">,</span> <span class="s2">&quot;org_counts&quot;</span><span class="p">])</span>
531
- <span class="o">.</span><span class="n">size</span><span class="p">()</span>
532
- <span class="c1"># give the column a nice name</span>
533
- <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">&#39;ref_counts&#39;</span><span class="p">)</span>
534
- <span class="c1"># sort first by total launches, then within a repo by ref launches</span>
535
- <span class="o">.</span><span class="n">sort_values</span><span class="p">([</span><span class="s1">&#39;org_counts&#39;</span><span class="p">,</span> <span class="s1">&#39;repo_counts&#39;</span><span class="p">,</span> <span class="s1">&#39;ref_counts&#39;</span><span class="p">],</span>
536
- <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>
537
- <span class="o">.</span><span class="n">set_index</span><span class="p">([</span><span class="s2">&quot;org&quot;</span><span class="p">,</span> <span class="s1">&#39;repo&#39;</span><span class="p">,</span> <span class="s1">&#39;ref&#39;</span><span class="p">])</span>
538
- <span class="p">)</span>
539
- </pre></div>
540
-
541
- </div>
542
- </div>
543
- </div>
544
-
545
- </div>
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">&#182;</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">&quot;https://archive.analytics.mybinder.org/index.jsonl&quot;</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">&quot;https://archive.analytics.mybinder.org/</span><span class="si">{}</span><span class="s2">&quot;</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">&#39;name&#39;</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">&gt;</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">&quot;Fetched data for </span><span class="si">{</span><span class="n">n</span><span class="si">}</span><span class="s2"> days.&quot;</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">&lt;ipython-input-3-dc969cf0de9b&gt;</span> in <span class="ansi-cyan-fg">&lt;module&gt;</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(&#34;https://archive.analytics.mybinder.org/{}&#34;.format(day[&#39;name&#39;]),
101
+ <span class="ansi-green-intense-fg ansi-bold">---&gt; 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">&gt;</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">--&gt; 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">--&gt; 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">--&gt; 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">&#34;nrows can only be passed if lines=True&#34;</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">--&gt; 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">--&gt; 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">--&gt; 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">&#34;storage_options passed with file object or non-fsspec file path&#34;</span>
149
+ <span class="ansi-green-fg"> 288</span> )
150
+ <span class="ansi-green-intense-fg ansi-bold">--&gt; 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">&#34;Content-Encoding&#34;</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">&#34;gzip&#34;</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">--&gt; 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">--&gt; 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">--&gt; 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">&lt;=</span> code <span class="ansi-yellow-intense-fg ansi-bold">&lt;</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">--&gt; 641</span><span class="ansi-yellow-intense-fg ansi-bold"> &#39;http&#39;, 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">&#39;default&#39;</span><span class="ansi-yellow-intense-fg ansi-bold">,</span> <span class="ansi-blue-intense-fg ansi-bold">&#39;http_error_default&#39;</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">--&gt; 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">--&gt; 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">--&gt; 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">&quot;/&quot;</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">&#39;.git&#39;</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">&#39;repo&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">df</span><span class="p">[</span><span class="s1">&#39;spec&#39;</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(&quot;/&quot;, 1)[0].replace(&quot;.git&quot;, &quot;&quot;))</span>
244
+ <span class="n">df</span><span class="p">[</span><span class="s1">&#39;org&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">df</span><span class="p">[</span><span class="s1">&#39;spec&#39;</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">&quot;/&quot;</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">&#39;ref&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">df</span><span class="p">[</span><span class="s1">&#39;spec&#39;</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">&quot;/&quot;</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">&#39;schema&#39;</span><span class="p">,</span> <span class="s1">&#39;version&#39;</span><span class="p">,</span> <span class="s1">&#39;spec&#39;</span><span class="p">,</span> <span class="s1">&#39;status&#39;</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">&#182;</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">&quot;timestamp&quot;</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">&quot;&quot;&quot;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"> &quot;&quot;&quot;</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">&gt;</span> <span class="n">now</span><span class="p">:</span>
353
+ <span class="k">break</span>
354
+
355
+ <span class="c1"># our &quot;monthly&quot; 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">&quot;timestamp&quot;</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">&quot;_monthly&quot;</span><span class="p">,</span> <span class="s2">&quot;_daily&quot;</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">&#39;30day active&#39;</span><span class="p">,</span> <span class="s1">&#39;1d active&#39;</span><span class="p">,</span> <span class="s1">&#39;7d active&#39;</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">&#182;</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">&#182;</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">&quot;timestamp&quot;</span><span class="p">)</span><span class="o">.</span><span class="n">resample</span><span class="p">(</span><span class="s1">&#39;D&#39;</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">&#39;repo&#39;</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">&#182;</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">&gt;</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">&#182;</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">&quot;repo&quot;</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">&quot;timestamp&quot;</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">&quot;Cumulative top20 launches:&quot;</span><span class="p">,</span> <span class="n">top20</span><span class="p">[</span><span class="s1">&#39;ref&#39;</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">&quot;The top20 repos are </span><span class="si">{:.1f}% o</span><span class="s2">f all &quot;</span>
551
+ <span class="s2">&quot;launches.&quot;</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">&#39;ref&#39;</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">&#182;</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">&quot;repo&quot;</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">&#39;repo_counts&#39;</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">&quot;org&quot;</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">&#39;org_counts&#39;</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">&#39;repo&#39;</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">&#39;org&#39;</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">&quot;provider&quot;</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">&#39;Launches&#39;</span><span class="p">)</span>
637
+ <span class="o">.</span><span class="n">sort_values</span><span class="p">(</span><span class="s1">&#39;Launches&#39;</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">&quot;org&quot;</span><span class="p">,</span> <span class="s2">&quot;repo&quot;</span><span class="p">,</span> <span class="s2">&quot;ref&quot;</span><span class="p">,</span> <span class="s2">&quot;repo_counts&quot;</span><span class="p">,</span> <span class="s2">&quot;org_counts&quot;</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">&#39;ref_counts&#39;</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">&#39;org_counts&#39;</span><span class="p">,</span> <span class="s1">&#39;repo_counts&#39;</span><span class="p">,</span> <span class="s1">&#39;ref_counts&#39;</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">&quot;org&quot;</span><span class="p">,</span> <span class="s1">&#39;repo&#39;</span><span class="p">,</span> <span class="s1">&#39;ref&#39;</span><span class="p">])</span>
662
+ <span class="p">)</span>
663
+ </pre></div>
664
+
665
+ </div>
666
+ </div>
667
+ </div>
668
+
669
+ </div>
670
+