Use fixed seeds for reproducible pseudorandomness
authorDebian Science Team <debian-science-maintainers@lists.alioth.debian.org>
Wed, 26 Aug 2020 21:34:50 +0000 (22:34 +0100)
committerRebecca N. Palmer <rebecca_palmer@zoho.com>
Wed, 26 Aug 2020 21:34:50 +0000 (22:34 +0100)
Author: Rebecca N. Palmer <rebecca_palmer@zoho.com>
Forwarded: no

Gbp-Pq: Name fix_random_seeds.patch

doc/source/getting_started/comparison/comparison_with_r.rst
doc/source/user_guide/advanced.rst
doc/source/user_guide/visualization.rst

index f67f46fc2b29ba98491947974cd3593e0b516ccb..7280b549c7ffa7696782aa0c5e85dfc541ba93df 100644 (file)
@@ -226,6 +226,7 @@ In ``pandas`` we may use :meth:`~pandas.pivot_table` method to handle this:
 
    import random
    import string
+   random.seed(123456) # for reproducibility
 
    baseball = pd.DataFrame(
        {'team': ["team %d" % (x + 1) for x in range(5)] * 5,
index d6f5c0c758b60a9199e6c4a676c4836aa4db4bc1..73468d157e412bf37aa01a45072f12036075ee54 100644 (file)
@@ -584,6 +584,7 @@ they need to be sorted. As with any index, you can use :meth:`~DataFrame.sort_in
 .. ipython:: python
 
    import random
+   random.seed(123456) # for reproducibility
    random.shuffle(tuples)
    s = pd.Series(np.random.randn(8), index=pd.MultiIndex.from_tuples(tuples))
    s
index 4fde053a2070faae92ee923a0d3d6488189d5317..91138743a613c6efd94711007fc328107b23fb6f 100644 (file)
@@ -992,6 +992,7 @@ are what constitutes the bootstrap plot.
    :suppress:
 
    np.random.seed(123456)
+   random.seed(123456) # for reproducibility - bootstrap_plot uses random.sample
 
 .. ipython:: python