Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: Segmentation fault in RollingGroupby.mean() with center=True and input with odd length #35552

Closed
2 of 3 tasks
wfvining opened this issue Aug 4, 2020 · 1 comment · Fixed by #35562
Closed
2 of 3 tasks
Labels
Regression Functionality that used to work in a prior pandas version Segfault Non-Recoverable Error Window rolling, ewma, expanding
Milestone

Comments

@wfvining
Copy link

wfvining commented Aug 4, 2020

  • I have checked that this issue has not already been reported.

  • 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

import pandas as pd

series = pd.Series(range(1, 5))
series.groupby(series).rolling(center=True, window=3).mean()

Problem description

With an odd-length series and center=True, RollingGroupby.mean() causes a segfault. If center=True is not provided, or the input series has an even length, then there is no no segfault (example below).

series = pd.Series(range(1, 6))
series.groupby(series).rolling(center=True, window=3).mean()

Outputs:

1  0              NaN
2  1              NaN
3  2              NaN
4  3              NaN
5  4    1.474760e+250
dtype: float64

The series can be grouped in any way, but the example above seemed simplest.

Expected Output

Should output a Series.

Output of pd.show_versions()

INSTALLED VERSIONS

commit : d9fff27
python : 3.7.7.final.0
python-bits : 64
OS : Linux
OS-release : 4.18.0-25-generic
Version : #26-Ubuntu SMP Mon Jun 24 09:32:08 UTC 2019
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8

pandas : 1.1.0
numpy : 1.19.1
pytz : 2020.1
dateutil : 2.8.1
pip : 20.1.1
setuptools : 49.2.0.post20200714
Cython : None
pytest : 6.0.1
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

@wfvining wfvining added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Aug 4, 2020
@jbrockmendel
Copy link
Member

cc @mroeschke

@jorisvandenbossche jorisvandenbossche added Window rolling, ewma, expanding and removed Needs Triage Issue that has not been reviewed by a pandas team member labels Aug 5, 2020
@jorisvandenbossche jorisvandenbossche added this to the 1.1.1 milestone Aug 5, 2020
@jorisvandenbossche jorisvandenbossche added Regression Functionality that used to work in a prior pandas version and removed Bug labels Aug 5, 2020
@jbrockmendel jbrockmendel added the Segfault Non-Recoverable Error label Aug 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Regression Functionality that used to work in a prior pandas version Segfault Non-Recoverable Error Window rolling, ewma, expanding
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants