Description
-
[X ] I have checked that this issue has not already been reported.
-
[X ] I have confirmed this bug exists on the latest version of pandas.
-
(optional) I have confirmed this bug exists on the master branch of pandas.
Note: Please read this guide detailing how to provide the necessary information for us to reproduce your bug.
Code Sample, a copy-pastable example
import numpy as np
import pandas as pd
ser = pd.Series(data=['n1', 'n2', 'n0', 'n4', 'n2', 'n1', 'n0', 'n3'], name='ser')
for _ in range(3):
np.random.seed(42)
print(ser.value_counts())
print(ser.value_counts(sort=False))
Problem description
The output of this file changes from one run to another. This creates a randomality which cannot be reproduced by np.random.seed(..).
Due to this randomality, the code cannot be made reproducible.
This non-reproducibility happens only from one run to the other; the loop in the code shows that the output is repeated exactly within the same run.
The code shows that the non-reproducibility happens both with value_counts(sort=True) (default value) and value_counts(sort=False).
Expected Output
Should be the same from one run to another.
Note
This could be related to #32514 or #32449 but I do not quite understand this.
Output of pd.show_versions()
INSTALLED VERSIONS
commit : f2ca0a2
python : 3.6.10.final.0
python-bits : 64
OS : Linux
OS-release : 4.15.0-112-generic
Version : #113-Ubuntu SMP Thu Jul 9 23:41:39 UTC 2020
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8
pandas : 1.1.1
numpy : 1.19.1
pytz : 2020.1
dateutil : 2.8.1
pip : 20.2.2
setuptools : 49.6.0
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : None
IPython : None
pandas_datareader: None
bs4 : None
bottleneck : None
fsspec : None
fastparquet : None
gcsfs : None
matplotlib : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pytables : None
pyxlsb : None
s3fs : None
scipy : 1.5.2
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None
numba : None