From: Debian Science Team Date: Thu, 9 Apr 2020 03:11:32 +0000 (+0100) Subject: Use fixed seeds for reproducible pseudorandomness X-Git-Tag: archive/raspbian/0.25.3+dfsg2-2+rpi1~6 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=0a0f06b6af2107f72e0fe1b8e6a8ad9918f5f222;p=pandas.git Use fixed seeds for reproducible pseudorandomness Author: Rebecca N. Palmer Forwarded: no Gbp-Pq: Name fix_random_seeds.patch --- diff --git a/doc/source/getting_started/comparison/comparison_with_r.rst b/doc/source/getting_started/comparison/comparison_with_r.rst index 444e886b..48609858 100644 --- a/doc/source/getting_started/comparison/comparison_with_r.rst +++ b/doc/source/getting_started/comparison/comparison_with_r.rst @@ -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, diff --git a/doc/source/user_guide/advanced.rst b/doc/source/user_guide/advanced.rst index a42ab4f0..936b6819 100644 --- a/doc/source/user_guide/advanced.rst +++ b/doc/source/user_guide/advanced.rst @@ -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 diff --git a/doc/source/user_guide/visualization.rst b/doc/source/user_guide/visualization.rst index 6589900c..cef09e40 100644 --- a/doc/source/user_guide/visualization.rst +++ b/doc/source/user_guide/visualization.rst @@ -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