Use fixed seeds for reproducible pseudorandomness
authorDebian Science Team <debian-science-maintainers@lists.alioth.debian.org>
Mon, 7 Dec 2020 23:06:28 +0000 (23:06 +0000)
committerRebecca N. Palmer <rebecca_palmer@zoho.com>
Mon, 7 Dec 2020 23:06:28 +0000 (23:06 +0000)
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 e1a4cfe49b7d1b3cbadf0d4563e6f4a9fa7a8a8f..717f7e968888d74ed9f7f3cebcfe9b1083c42069 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 a0331dd632583556194d951f947a513534727fc4..0b90417b3ee7d125360e078c56758e6baa0e2d7f 100644 (file)
@@ -586,6 +586,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 5bc87bca8721190bc38236bb7c378d893a17ac33..c139d803ceeee1276c7c92533a0f3f5ac74fbbf6 100644 (file)
@@ -991,6 +991,7 @@ are what constitutes the bootstrap plot.
    :suppress:
 
    np.random.seed(123456)
+   random.seed(123456) # for reproducibility - bootstrap_plot uses random.sample
 
 .. ipython:: python