Skip to content

Commit 9f1cd31

Browse files
committed
Updating examples
1 parent 3033f77 commit 9f1cd31

File tree

1 file changed

+36
-36
lines changed

1 file changed

+36
-36
lines changed

examples/salmon.ipynb

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@
107107
},
108108
{
109109
"cell_type": "code",
110-
"execution_count": 10,
110+
"execution_count": 5,
111111
"metadata": {},
112112
"outputs": [],
113113
"source": [
@@ -124,7 +124,7 @@
124124
},
125125
{
126126
"cell_type": "code",
127-
"execution_count": 24,
127+
"execution_count": 6,
128128
"metadata": {},
129129
"outputs": [],
130130
"source": [
@@ -141,7 +141,7 @@
141141
},
142142
{
143143
"cell_type": "code",
144-
"execution_count": 14,
144+
"execution_count": 7,
145145
"metadata": {},
146146
"outputs": [],
147147
"source": [
@@ -161,16 +161,16 @@
161161
"source": [
162162
"## Modeling changes\n",
163163
"\n",
164-
"To see how the population changes from year-to-year, I'll use `diff` to compute the absolute difference between each year and the next.\n"
164+
"To see how the population changes from year-to-year, I'll use `diff` to compute the absolute difference between each year and the next and `shift` to align the changes with the year they happened."
165165
]
166166
},
167167
{
168168
"cell_type": "code",
169-
"execution_count": 25,
169+
"execution_count": 8,
170170
"metadata": {},
171171
"outputs": [],
172172
"source": [
173-
"abs_diffs = pop_series.diff()\n",
173+
"abs_diffs = pop_series.diff().shift(-1)\n",
174174
"abs_diffs"
175175
]
176176
},
@@ -183,7 +183,7 @@
183183
},
184184
{
185185
"cell_type": "code",
186-
"execution_count": 26,
186+
"execution_count": 9,
187187
"metadata": {},
188188
"outputs": [],
189189
"source": [
@@ -195,12 +195,13 @@
195195
"cell_type": "markdown",
196196
"metadata": {},
197197
"source": [
198-
"These relative differences are observed annual net growth rates. So let's drop the `0` and save them."
198+
"These relative differences are observed annual net growth rates.\n",
199+
"So let's drop the `NaN` and save them."
199200
]
200201
},
201202
{
202203
"cell_type": "code",
203-
"execution_count": 27,
204+
"execution_count": 10,
204205
"metadata": {},
205206
"outputs": [],
206207
"source": [
@@ -217,7 +218,7 @@
217218
},
218219
{
219220
"cell_type": "code",
220-
"execution_count": 28,
221+
"execution_count": 11,
221222
"metadata": {},
222223
"outputs": [],
223224
"source": [
@@ -237,7 +238,7 @@
237238
},
238239
{
239240
"cell_type": "code",
240-
"execution_count": 29,
241+
"execution_count": 12,
241242
"metadata": {},
242243
"outputs": [],
243244
"source": [
@@ -256,7 +257,7 @@
256257
},
257258
{
258259
"cell_type": "code",
259-
"execution_count": 30,
260+
"execution_count": 13,
260261
"metadata": {},
261262
"outputs": [],
262263
"source": [
@@ -276,7 +277,7 @@
276277
},
277278
{
278279
"cell_type": "code",
279-
"execution_count": 31,
280+
"execution_count": 14,
280281
"metadata": {},
281282
"outputs": [],
282283
"source": [
@@ -292,7 +293,7 @@
292293
},
293294
{
294295
"cell_type": "code",
295-
"execution_count": 32,
296+
"execution_count": 15,
296297
"metadata": {},
297298
"outputs": [],
298299
"source": [
@@ -308,7 +309,7 @@
308309
},
309310
{
310311
"cell_type": "code",
311-
"execution_count": 33,
312+
"execution_count": 16,
312313
"metadata": {},
313314
"outputs": [],
314315
"source": [
@@ -341,7 +342,7 @@
341342
},
342343
{
343344
"cell_type": "code",
344-
"execution_count": 35,
345+
"execution_count": 17,
345346
"metadata": {},
346347
"outputs": [],
347348
"source": [
@@ -357,7 +358,7 @@
357358
},
358359
{
359360
"cell_type": "code",
360-
"execution_count": 42,
361+
"execution_count": 18,
361362
"metadata": {},
362363
"outputs": [],
363364
"source": [
@@ -370,8 +371,7 @@
370371
" \"\"\"\n",
371372
" for i in range(iters):\n",
372373
" results = run_simulation(system, update_func)\n",
373-
" results.plot(color='gray', label='_nolegend', \n",
374-
" linewidth=1, alpha=0.3)"
374+
" results.plot(color='gray', label='', linewidth=1, alpha=0.3)"
375375
]
376376
},
377377
{
@@ -385,7 +385,7 @@
385385
},
386386
{
387387
"cell_type": "code",
388-
"execution_count": 43,
388+
"execution_count": 19,
389389
"metadata": {},
390390
"outputs": [],
391391
"source": [
@@ -414,7 +414,7 @@
414414
},
415415
{
416416
"cell_type": "code",
417-
"execution_count": 45,
417+
"execution_count": 20,
418418
"metadata": {},
419419
"outputs": [],
420420
"source": [
@@ -432,7 +432,7 @@
432432
},
433433
{
434434
"cell_type": "code",
435-
"execution_count": 50,
435+
"execution_count": 21,
436436
"metadata": {},
437437
"outputs": [],
438438
"source": [
@@ -448,7 +448,7 @@
448448
},
449449
{
450450
"cell_type": "code",
451-
"execution_count": 51,
451+
"execution_count": 22,
452452
"metadata": {},
453453
"outputs": [],
454454
"source": [
@@ -464,7 +464,7 @@
464464
},
465465
{
466466
"cell_type": "code",
467-
"execution_count": 52,
467+
"execution_count": 23,
468468
"metadata": {},
469469
"outputs": [],
470470
"source": [
@@ -481,7 +481,7 @@
481481
},
482482
{
483483
"cell_type": "code",
484-
"execution_count": 53,
484+
"execution_count": 24,
485485
"metadata": {},
486486
"outputs": [],
487487
"source": [
@@ -500,7 +500,7 @@
500500
},
501501
{
502502
"cell_type": "code",
503-
"execution_count": 54,
503+
"execution_count": 25,
504504
"metadata": {},
505505
"outputs": [],
506506
"source": [
@@ -516,7 +516,7 @@
516516
},
517517
{
518518
"cell_type": "code",
519-
"execution_count": 55,
519+
"execution_count": 26,
520520
"metadata": {},
521521
"outputs": [],
522522
"source": [
@@ -532,7 +532,7 @@
532532
},
533533
{
534534
"cell_type": "code",
535-
"execution_count": 56,
535+
"execution_count": 27,
536536
"metadata": {},
537537
"outputs": [],
538538
"source": [
@@ -567,7 +567,7 @@
567567
},
568568
{
569569
"cell_type": "code",
570-
"execution_count": 66,
570+
"execution_count": 28,
571571
"metadata": {},
572572
"outputs": [],
573573
"source": [
@@ -585,7 +585,7 @@
585585
},
586586
{
587587
"cell_type": "code",
588-
"execution_count": 59,
588+
"execution_count": 29,
589589
"metadata": {},
590590
"outputs": [],
591591
"source": [
@@ -601,7 +601,7 @@
601601
},
602602
{
603603
"cell_type": "code",
604-
"execution_count": 60,
604+
"execution_count": 30,
605605
"metadata": {},
606606
"outputs": [],
607607
"source": [
@@ -617,7 +617,7 @@
617617
},
618618
{
619619
"cell_type": "code",
620-
"execution_count": 61,
620+
"execution_count": 31,
621621
"metadata": {},
622622
"outputs": [],
623623
"source": [
@@ -633,7 +633,7 @@
633633
},
634634
{
635635
"cell_type": "code",
636-
"execution_count": 62,
636+
"execution_count": 32,
637637
"metadata": {},
638638
"outputs": [],
639639
"source": [
@@ -649,7 +649,7 @@
649649
},
650650
{
651651
"cell_type": "code",
652-
"execution_count": 63,
652+
"execution_count": 33,
653653
"metadata": {},
654654
"outputs": [],
655655
"source": [
@@ -665,7 +665,7 @@
665665
},
666666
{
667667
"cell_type": "code",
668-
"execution_count": 64,
668+
"execution_count": 34,
669669
"metadata": {},
670670
"outputs": [],
671671
"source": [
@@ -689,7 +689,7 @@
689689
"name": "python",
690690
"nbconvert_exporter": "python",
691691
"pygments_lexer": "ipython3",
692-
"version": "3.8.16"
692+
"version": "3.10.13"
693693
}
694694
},
695695
"nbformat": 4,

0 commit comments

Comments
 (0)