-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Time-based rolling apply inconsistent behavior on NaN rows #17311
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
Comments
@YS-L : Thanks for reporting this! That does seem a little odd to me. I don't see why we shouldn't have consistency here. This behavior seems counter-intuitive. |
Looks like this is a duplicate of #15305, which had been fixed recently on master! |
Just to make sure, did you try pulling |
Yes, pulled Thought I found a fix after some digging into |
@YS-L : No worries! We don't expect everyone to pull But actually, thanks for taking the time to do this. We're happy to see that we anticipated your problem 😄 |
Code Sample, a copy-pastable example if possible
Problem description
Output of the above code sample:
It seems that the user function did not get applied to the window corresponding to the original NaN row, resulting in NaN as the result for that row. Why is that? The more reasonable output would be all 42 because by the
min_periods
constraint, all of the windows are valid.Compare this to the equivalent fixed window version:
which gives the following output:
Is this inconsistency between fixed and variable size window a desired behavior?
Expected Output
Output of
pd.show_versions()
INSTALLED VERSIONS
commit: None
python: 2.7.13.final.0
python-bits: 64
OS: Linux
OS-release: 4.11.9-1-ARCH
machine: x86_64
processor:
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: None.None
pandas: 0.21.0.dev+316.gf2b0bdc9b
pytest: None
pip: 9.0.1
setuptools: 36.2.5
Cython: 0.26
numpy: 1.13.1
scipy: None
pyarrow: None
xarray: None
IPython: 5.4.1
sphinx: None
patsy: None
dateutil: 2.6.1
pytz: 2017.2
blosc: None
bottleneck: None
tables: None
numexpr: None
feather: None
matplotlib: None
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: None
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: None
s3fs: None
pandas_gbq: None
pandas_datareader: None
The text was updated successfully, but these errors were encountered: