Use fixed seeds for reproducible pseudorandomness
authorDebian Science Team <debian-science-maintainers@lists.alioth.debian.org>
Fri, 3 Apr 2020 20:56:02 +0000 (21:56 +0100)
committerRebecca N. Palmer <rebecca_palmer@zoho.com>
Fri, 3 Apr 2020 20:56:02 +0000 (21:56 +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 444e886bc951d29aa57981e3f4f7cf4746acd386..48609858cf1a443f162305e9d46adafbba90ffa6 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 a42ab4f0255bdc647bc3ea242a755836a6e6aee1..936b6819c53ac45fa54f6f88a90b9e4e8413aaa6 100644 (file)
@@ -565,6 +565,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 6589900c8491c8836efc4bb8ff6093ed3a8e9a34..cef09e40e544523897c40a6f4321b790209252b4 100644 (file)
@@ -996,6 +996,7 @@ are what constitutes the bootstrap plot.
    :suppress:
 
    np.random.seed(123456)
+   random.seed(123456) # for reproducibility - bootstrap_plot uses random.sample
 
 .. ipython:: python