Skip to content

Commit dfe81d8

Browse files
committed
Update
1 parent f451760 commit dfe81d8

40 files changed

+246
-189
lines changed

chapter01_basic/02_pandas.ipynb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,11 @@
122122
{
123123
"data": {
124124
"text/plain": [
125-
"Index(['Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday',\n",
126-
" 'Monday', 'Tuesday', 'Wednesday', 'Thursday',\n",
125+
"Index(['Tuesday', 'Wednesday', 'Thursday', 'Friday',\n",
126+
" 'Saturday', 'Sunday', 'Monday', 'Tuesday',\n",
127127
" ...\n",
128-
" 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday',\n",
129-
" 'Sunday', 'Monday', 'Tuesday', 'Wednesday'],\n",
128+
" 'Friday', 'Saturday', 'Sunday', 'Monday',\n",
129+
" 'Tuesday', 'Wednesday'],\n",
130130
" dtype='object', name='Date', length=261)"
131131
]
132132
},

chapter01_basic/03_numpy.ipynb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@
7878
"name": "stdout",
7979
"output_type": "stream",
8080
"text": [
81-
"101 ms ± 5.12 ms per loop (mean ± std. dev. of 7 runs, 10 loops each)\n"
81+
"101 ms ± 5.12 ms per loop (mean ± std. dev. of 7 runs,\n",
82+
" 10 loops each)\n"
8283
]
8384
}
8485
],
@@ -146,7 +147,8 @@
146147
"name": "stdout",
147148
"output_type": "stream",
148149
"text": [
149-
"1.09 ms ± 37.3 µs per loop (mean ± std. dev. of 7 runs, 1000 loops each)\n"
150+
"1.09 ms ± 37.3 µs per loop (mean ± std. dev. of 7 runs,\n",
151+
" 1000 loops each)\n"
150152
]
151153
}
152154
],

chapter02_best_practices/01_shell.ipynb

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,12 @@
5454
"output_type": "stream",
5555
"text": [
5656
"total 100\n",
57-
"-rw-rw-r-- 1 cyrille 769 Dec 12 10:23 00_intro.md\n",
58-
"-rw-rw-r-- 1 cyrille 2473 Dec 12 14:21 01_shell.md\n",
57+
"-rw-rw-r-- 1 owner 769 Dec 12 10:23 00_intro.md\n",
58+
"-rw-rw-r-- 1 owner 2473 Dec 12 14:21 01_shell.md\n",
5959
"...\n",
60-
"-rw-rw-r-- 1 cyrille 9390 Dec 12 11:46 08_test.md\n",
61-
"-rw-rw-r-- 1 cyrille 5032 Dec 12 10:23 09_debugging.md\n",
62-
"drwxrwxr-x 2 cyrille 4096 Aug 1 16:49 images\n"
60+
"-rw-rw-r-- 1 owner 9390 Dec 12 11:46 08_test.md\n",
61+
"-rw-rw-r-- 1 owner 5032 Dec 12 10:23 09_debugging.md\n",
62+
"drwxrwxr-x 2 owner 4096 Aug 1 16:49 images\n"
6363
]
6464
}
6565
],
@@ -200,7 +200,8 @@
200200
"name": "stdout",
201201
"output_type": "stream",
202202
"text": [
203-
"rmdir: failed to remove 'markdown_files': Directory not empty\n"
203+
"rmdir: failed to remove 'markdown_files':\n",
204+
" Directory not empty\n"
204205
]
205206
}
206207
],

chapter02_best_practices/02_py3.ipynb

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,8 @@
163163
"metadata": {},
164164
"outputs": [],
165165
"source": [
166-
"def kinetic_energy(mass: 'kg', velocity: 'm/s') -> 'J':\n",
166+
"def kinetic_energy(mass: 'kg',\n",
167+
" velocity: 'm/s') -> 'J':\n",
167168
" \"\"\"The annotations serve here as documentation.\"\"\"\n",
168169
" return .5 * mass * velocity ** 2"
169170
]
@@ -325,7 +326,8 @@
325326
"name": "stdout",
326327
"output_type": "stream",
327328
"text": [
328-
"1 s ± 0 ns per loop (mean ± std. dev. of 1 run, 1 loop each)\n"
329+
"1 s ± 0 ns per loop (mean ± std. dev. of 1 run,\n",
330+
" 1 loop each)\n"
329331
]
330332
}
331333
],
@@ -342,7 +344,8 @@
342344
"name": "stdout",
343345
"output_type": "stream",
344346
"text": [
345-
"1 s ± 0 ns per loop (mean ± std. dev. of 1 run, 1 loop each)\n"
347+
"1 s ± 0 ns per loop (mean ± std. dev. of 1 run,\n",
348+
" 1 loop each)\n"
346349
]
347350
}
348351
],
@@ -373,7 +376,8 @@
373376
"name": "stdout",
374377
"output_type": "stream",
375378
"text": [
376-
"1 s ± 0 ns per loop (mean ± std. dev. of 1 run, 1 loop each)\n"
379+
"1 s ± 0 ns per loop (mean ± std. dev. of 1 run,\n",
380+
" 1 loop each)\n"
377381
]
378382
}
379383
],
@@ -390,7 +394,8 @@
390394
"name": "stdout",
391395
"output_type": "stream",
392396
"text": [
393-
"6.14 µs ± 0 ns per loop (mean ± std. dev. of 1 run, 1 loop each)\n"
397+
"6.14 µs ± 0 ns per loop (mean ± std. dev. of 1 run,\n",
398+
" 1 loop each)\n"
394399
]
395400
}
396401
],
@@ -494,7 +499,8 @@
494499
{
495500
"data": {
496501
"text/plain": [
497-
"[PosixPath('images/github_new.png'), PosixPath('images/folder.png')]"
502+
"[PosixPath('images/github_new.png'),\n",
503+
" PosixPath('images/folder.png')]"
498504
]
499505
},
500506
"execution_count": 30,
@@ -522,7 +528,8 @@
522528
"metadata": {},
523529
"outputs": [],
524530
"source": [
525-
"my_list = [r.normalvariate(0, 1) for _ in range(100000)]"
531+
"my_list = [r.normalvariate(0, 1)\n",
532+
" for _ in range(100000)]"
526533
]
527534
},
528535
{

chapter02_best_practices/03_git.ipynb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"output_type": "stream",
2828
"text": [
2929
"Initialized empty Git repository in\n",
30-
"~/git/cookbook-2nd/chapter02_best_practices/myproject/.git/\n"
30+
"~/git/cookbook-2nd/chapter02/myproject/.git/\n"
3131
]
3232
}
3333
],
@@ -44,7 +44,7 @@
4444
"name": "stdout",
4545
"output_type": "stream",
4646
"text": [
47-
"~/git/cookbook-2nd/chapter02_best_practices/myproject\n"
47+
"~/git/cookbook-2nd/chapter02/myproject\n"
4848
]
4949
}
5050
],
@@ -189,7 +189,8 @@
189189
"text": [
190190
"On branch master\n",
191191
"Changes not staged for commit:\n",
192-
" (use \"git add <file>...\" to update what will be committed)\n",
192+
" (use \"git add <file>...\" to update what will\n",
193+
" be committed)\n",
193194
"\n",
194195
" modified: file.txt\n",
195196
"\n",

chapter02_best_practices/04_git_advanced.ipynb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"name": "stdout",
1717
"output_type": "stream",
1818
"text": [
19-
"/home/cyrille/git/cookbook-2nd/chapter02_best_practices\n"
19+
"/home/cyrille/git/cookbook-2nd/chapter02\n"
2020
]
2121
}
2222
],
@@ -239,7 +239,7 @@
239239
"name": "stdout",
240240
"output_type": "stream",
241241
"text": [
242-
"HEAD is now at 045df6a Add exclamation mark to file.txt\n"
242+
"HEAD is now at 045df6 Add exclamation mark to file.txt\n"
243243
]
244244
}
245245
],
@@ -335,8 +335,9 @@
335335
"name": "stdout",
336336
"output_type": "stream",
337337
"text": [
338-
"Saved working directory and index state WIP on master: 045df6a Add exclamation mark to file.txt\n",
339-
"HEAD is now at 045df6a Add exclamation mark to file.txt\n"
338+
"Saved working directory and index state WIP on master:\n",
339+
"045df6a Add exclamation mark to file.txt\n",
340+
"HEAD is now at 045df6 Add exclamation mark to file.txt\n"
340341
]
341342
}
342343
],
@@ -372,13 +373,12 @@
372373
"text": [
373374
"On branch master\n",
374375
"Changes not staged for commit:\n",
375-
" (use \"git add <file>...\" to update what will be committed)\n",
376-
" (use \"git checkout -- <file>...\" to discard changes in working directory)\n",
377376
"\n",
378377
" modified: file.txt\n",
379378
"\n",
380-
"no changes added to commit (use \"git add\" and/or \"git commit -a\")\n",
381-
"Dropped refs/stash@{0} (c9071a21bc631bc11590861f0540304d62e641ab)\n"
379+
"no changes added to commit\n",
380+
" (use \"git add\" and/or \"git commit -a\")\n",
381+
"Dropped refs/stash@{0} (c9071a)\n"
382382
]
383383
}
384384
],

chapter03_notebook/02_nbformat.ipynb

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,8 @@
105105
"name": "stdout",
106106
"output_type": "stream",
107107
"text": [
108-
"dict_keys(['cells', 'metadata', 'nbformat', 'nbformat_minor'])\n",
108+
"dict_keys(['cells', 'metadata',\n",
109+
" 'nbformat', 'nbformat_minor'])\n",
109110
"nbformat 4.4\n"
110111
]
111112
}
@@ -157,7 +158,7 @@
157158
" 'execution_count': 1,\n",
158159
" 'metadata': {},\n",
159160
" 'outputs': [{'data': {'image/png': 'iVBOR...QmCC\\n',\n",
160-
" 'text/plain': ['<matplotlib.figure.Figure at ..>']},\n",
161+
" 'text/plain': ['<matplotlib Figure at ...>']},\n",
161162
" 'metadata': {},\n",
162163
" 'output_type': 'display_data'}],\n",
163164
" 'source': ['import numpy as np\\n',\n",
@@ -286,12 +287,12 @@
286287
"name": "stdout",
287288
"output_type": "stream",
288289
"text": [
289-
"Writing mytemplate.tplx\n"
290+
"Writing temp.tplx\n"
290291
]
291292
}
292293
],
293294
"source": [
294-
"%%writefile mytemplate.tplx\n",
295+
"%%writefile temp.tplx\n",
295296
"((*- extends 'article.tplx' -*))\n",
296297
"\n",
297298
"((* block author *))\n",
@@ -317,17 +318,18 @@
317318
"[NbConvertApp] Making directory test_files\n",
318319
"[NbConvertApp] Writing 16695 bytes to notebook.tex\n",
319320
"[NbConvertApp] Building PDF\n",
320-
"[NbConvertApp] Running xelatex 3 times: ['xelatex', 'notebook.tex']\n",
321-
"[NbConvertApp] Running bibtex 1 time: ['bibtex', 'notebook']\n",
322-
"[NbConvertApp] WARNING | bibtex had problems, most likely because there were no citations\n",
321+
"[NbConvertApp] Running xelatex 3 times:\n",
322+
" ['xelatex', 'notebook.tex']\n",
323+
"[NbConvertApp] Running bibtex 1 time:\n",
324+
" ['bibtex', 'notebook']\n",
323325
"[NbConvertApp] PDF successfully created\n",
324326
"[NbConvertApp] Writing 16147 bytes to test.pdf\n"
325327
]
326328
}
327329
],
328330
"source": [
329331
"%%bash\n",
330-
"jupyter nbconvert --to pdf --template mytemplate test.ipynb"
332+
"jupyter nbconvert --to pdf --template temp test.ipynb"
331333
]
332334
}
333335
],

chapter03_notebook/03_widgets.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,8 @@
103103
}
104104
],
105105
"source": [
106-
"@widgets.interact_manual(color=['blue', 'red', 'green'],\n",
107-
" lw=(1., 10.))\n",
106+
"@widgets.interact_manual(\n",
107+
" color=['blue', 'red', 'green'], lw=(1., 10.))\n",
108108
"def plot(freq=1., color='blue', lw=2, grid=True):\n",
109109
" t = np.linspace(-1., +1., 1000)\n",
110110
" fig, ax = plt.subplots(1, 1, figsize=(8, 6))\n",

chapter03_notebook/05_custom_notebook.ipynb

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,10 @@
4141
"\n",
4242
"## This is an application.\n",
4343
"\n",
44-
"## The date format used by logging formatters for %(asctime)s\n",
44+
"## The date format used by logging formatters\n",
4545
"#c.Application.log_datefmt = '%Y-%m-%d %H:%M:%S'\n",
4646
"\n",
47-
"## The Logging format template\n",
48-
"#c.Application.log_format = '[%(name)s]%(highlevel)s %(message)s'\n",
49-
"\n",
50-
"## Set the log level by value or name.\n",
51-
"#c.Application.log_level = 30\n",
47+
"[...]\n",
5248
"\n",
5349
"#-------------------------------------------------------\n",
5450
"# JupyterApp(Application) configuration\n",

chapter04_optimization/01_timeit.ipynb

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525
"name": "stdout",
2626
"output_type": "stream",
2727
"text": [
28-
"21.6 ms ± 343 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)\n"
28+
"21.6 ms ± 343 µs per loop (mean ± std. dev. of 7 runs,\n",
29+
" 10 loops each)\n"
2930
]
3031
}
3132
],
@@ -42,7 +43,8 @@
4243
"name": "stdout",
4344
"output_type": "stream",
4445
"text": [
45-
"22 ms ± 522 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)\n"
46+
"22 ms ± 522 µs per loop (mean ± std. dev. of 7 runs,\n",
47+
" 10 loops each)\n"
4648
]
4749
}
4850
],
@@ -70,7 +72,8 @@
7072
"name": "stdout",
7173
"output_type": "stream",
7274
"text": [
73-
"160 µs ± 959 ns per loop (mean ± std. dev. of 7 runs, 10000 loops each)\n"
75+
"160 µs ± 959 ns per loop (mean ± std. dev. of 7 runs,\n",
76+
" 10000 loops each)\n"
7477
]
7578
}
7679
],

0 commit comments

Comments
 (0)