-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
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 during a "custom" rolling operation #44470
Comments
A stipulation of rolling operations is that the result is the same shape as the input; therefore, the arrays in Instead of segfaulting, pandas should return an error checking that these lengths are equal. |
@mroeschke Also, when a rolling operation that requires equal window-sizes, you can check that it does satisfy that, and raise an error only if needed. Maybe Moreover - why is this a requirement? I mean |
@erezinman there is already #44497 |
Yes, thank you. I see it takes care of my first statement. |
This is to achieve API output consistency with native rolling operations which also returns a result is the same shape as the input. https://pandas.pydata.org/docs/user_guide/window.html If this API breaking change was made, it's also unclear what the corresponding index (or column with |
One way is to solve this is to allow returning the labels (much like in Another possibility is to just have the first/center item in the window (depending on the What do you think? |
The second sound reasonable, but currently the code needs significant refactoring to support outputs that are not the same shape as the input. |
As a work around, you can always iterate over the window object and use e.g. |
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
I have confirmed this bug exists on the master branch of pandas.
Reproducible Example
Issue Description
(Maybe related to #43267 ? Couldn't tell.)
I'm trying to create a custom
BaseIndexer
for a.rolling
operation. The extraction of the window is quick and efficient, yet when I attempt to perform various operations on it I get the seg-fault error:I have created an MWE for this behavior using a fixed-indexer (that carries the same name). The original indexer was supposed to produce a rolling-operation with overlaps, so the above indexer is similar in the sense that it creates a 1-day windows 1-hour apart for a one-second index.
Expected Behavior
Hmmm... Not to have a seg-fault error?
Installed Versions
INSTALLED VERSIONS
commit : 945c9ed
python : 3.8.9.final.0
python-bits : 64
OS : Linux
OS-release : 5.4.0-77-generic
Version : #86~18.04.1-Ubuntu SMP Fri Jun 18 01:23:22 UTC 2021
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8
pandas : 1.3.4
numpy : 1.18.5
pytz : 2018.3
dateutil : 2.8.1
pip : 21.1.3
setuptools : 57.4.0
Cython : None
pytest : 6.2.2
hypothesis : None
sphinx : 3.5.3
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : 0.999999999
pymysql : None
psycopg2 : None
jinja2 : 2.11.3
IPython : None
pandas_datareader: None
bs4 : 4.6.0
bottleneck : None
fsspec : 0.8.7
fastparquet : None
gcsfs : None
matplotlib : 3.1.3
numexpr : 2.7.3
odfpy : None
openpyxl : 3.0.7
pandas_gbq : None
pyarrow : None
pyxlsb : None
s3fs : None
scipy : 1.4.1
sqlalchemy : None
tables : 3.6.1
tabulate : 0.8.9
xarray : None
xlrd : 1.2.0
xlwt : None
numba : None
None
Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)
The text was updated successfully, but these errors were encountered: