Skip to content

Commit 671d782

Browse files
authored
bpo-36018: Update example to show mean and stdev (GH-13047)
1 parent 482b6b5 commit 671d782

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

Doc/whatsnew/3.8.rst

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -424,17 +424,19 @@ and manipulating normal distributions of a random variable.
424424
::
425425

426426
>>> temperature_feb = NormalDist.from_samples([4, 12, -3, 2, 7, 14])
427-
>>> temperature_feb
428-
NormalDist(mu=6.0, sigma=6.356099432828281)
427+
>>> temperature_feb.mean
428+
6.0
429+
>>> temperature_feb.stdev
430+
6.356099432828281
429431

430432
>>> temperature_feb.cdf(3) # Chance of being under 3 degrees
431433
0.3184678262814532
432434
>>> # Relative chance of being 7 degrees versus 10 degrees
433435
>>> temperature_feb.pdf(7) / temperature_feb.pdf(10)
434436
1.2039930378537762
435437

436-
>>> el_nino = NormalDist(4, 2.5)
437-
>>> temperature_feb += el_nino # Add in a climate effect
438+
>>> el_niño = NormalDist(4, 2.5)
439+
>>> temperature_feb += el_niño # Add in a climate effect
438440
>>> temperature_feb
439441
NormalDist(mu=10.0, sigma=6.830080526611674)
440442

0 commit comments

Comments
 (0)