Skip to content

Commit cc93c9d

Browse files
Debian Science Teamrebecca-palmer
Debian Science Team
authored andcommitted
Use fixed seeds for reproducible pseudorandomness
Author: Rebecca N. Palmer <[email protected]> Forwarded: no Gbp-Pq: Name fix_random_seeds.patch
1 parent b4cb52a commit cc93c9d

File tree

3 files changed

+3
-0
lines changed

3 files changed

+3
-0
lines changed

doc/source/getting_started/comparison/comparison_with_r.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ In ``pandas`` we may use :meth:`~pandas.pivot_table` method to handle this:
226226
227227
import random
228228
import string
229+
random.seed(123456) # for reproducibility
229230
230231
baseball = pd.DataFrame(
231232
{'team': ["team %d" % (x + 1) for x in range(5)] * 5,

doc/source/user_guide/advanced.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -584,6 +584,7 @@ they need to be sorted. As with any index, you can use :meth:`~DataFrame.sort_in
584584
.. ipython:: python
585585
586586
import random
587+
random.seed(123456) # for reproducibility
587588
random.shuffle(tuples)
588589
s = pd.Series(np.random.randn(8), index=pd.MultiIndex.from_tuples(tuples))
589590
s

doc/source/user_guide/visualization.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -992,6 +992,7 @@ are what constitutes the bootstrap plot.
992992
:suppress:
993993
994994
np.random.seed(123456)
995+
random.seed(123456) # for reproducibility - bootstrap_plot uses random.sample
995996
996997
.. ipython:: python
997998

0 commit comments

Comments
 (0)