BUG: Setting closed='neither' for rolling function of Series leads to mean() producing nan values #39038
Closed
1 of 2 tasks
Labels
Window
rolling, ewma, expanding
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.
Code Sample, a copy-pastable example
Problem description
In the current version of pandas, the call to mean() produces a series of nan-values. For pandas 1.1.5, the output was different providing valid values starting from the fifth entry of the series.
Expected Output
2018-01-31 NaN
2018-02-28 NaN
2018-03-31 NaN
2018-04-30 NaN
2018-05-31 2.0
2018-06-30 3.0
2018-07-31 4.0
2018-08-31 5.0
2018-09-30 6.0
2018-10-31 7.0
2018-11-30 8.0
2018-12-31 9.0
2019-01-31 10.0
2019-02-28 11.0
2019-03-31 12.0
2019-04-30 13.0
2019-05-31 14.0
2019-06-30 15.0
2019-07-31 16.0
2019-08-31 17.0
Freq: M, dtype: float64
Output of
pd.show_versions()
INSTALLED VERSIONS
commit : 3e89b4c
python : 3.8.5.final.0
python-bits : 64
OS : Linux
OS-release : 4.19.128-microsoft-standard
Version : #1 SMP Tue Jun 23 12:58:10 UTC 2020
machine : x86_64
processor :
byteorder : little
LC_ALL : None
LANG : C.UTF-8
LOCALE : en_US.UTF-8
pandas : 1.2.0
numpy : 1.19.5
pytz : 2020.5
dateutil : 2.8.1
pip : 20.2.3
setuptools : 50.3.0
Cython : 0.29.17
pytest : 6.0.2
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 2.11.2
IPython : 7.18.1
pandas_datareader: None
bs4 : None
bottleneck : None
fsspec : None
fastparquet : None
gcsfs : None
matplotlib : 3.3.3
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pyxlsb : None
s3fs : None
scipy : 1.6.0
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None
numba : None
The text was updated successfully, but these errors were encountered: