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: Sum on large integers incorrect after rolling timewindow #40043

Closed
2 of 3 tasks
snthibaud opened this issue Feb 25, 2021 · 2 comments
Closed
2 of 3 tasks

BUG: Sum on large integers incorrect after rolling timewindow #40043

snthibaud opened this issue Feb 25, 2021 · 2 comments
Labels
Bug Closing Candidate May be closeable, needs more eyeballs Duplicate Report Duplicate issue or pull request Window rolling, ewma, expanding

Comments

@snthibaud
Copy link

  • 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
from datetime import datetime, timedelta

s1 = pd.Series([138, 2377900603251717750], index=pd.Index([datetime(year=1970, month=1, day=1), datetime(year=1970, month=1, day=1)+timedelta(microseconds=1)]))
s2 = s1.rolling("1D").sum()
print(s2.sum() >= s1.sum())

Problem description

The sum of the rolling window should be higher or equal to the original series because only positive values are in it. However, 'False' is printed.

Expected Output

True

Output of pd.show_versions()

INSTALLED VERSIONS ------------------ commit : 7d32926 python : 3.7.10.final.0 python-bits : 64 OS : Darwin OS-release : 20.3.0 Version : Darwin Kernel Version 20.3.0: Thu Jan 21 00:07:06 PST 2021; root:xnu-7195.81.3~1/RELEASE_X86_64 machine : x86_64 processor : i386 byteorder : little LC_ALL : None LANG : None LOCALE : None.UTF-8 pandas : 1.2.2 numpy : 1.19.4 pytz : 2020.1 dateutil : 2.8.1 pip : 21.0.1 setuptools : 49.6.0.post20210108 Cython : None pytest : 6.2.2 hypothesis : 6.3.1 sphinx : None blosc : None feather : None xlsxwriter : None lxml.etree : 4.5.2 html5lib : None pymysql : 1.0.2 psycopg2 : None jinja2 : 2.11.2 IPython : 7.20.0 pandas_datareader: None bs4 : 4.7.1 bottleneck : None fsspec : None fastparquet : None gcsfs : None matplotlib : 3.2.2 numexpr : None odfpy : None openpyxl : 3.0.6 pandas_gbq : None pyarrow : 3.0.0 pyxlsb : None s3fs : None scipy : 1.6.0 sqlalchemy : 1.3.23 tables : None tabulate : None xarray : None xlrd : None xlwt : None numba : None
@snthibaud snthibaud added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Feb 25, 2021
@phofl
Copy link
Member

phofl commented Feb 26, 2021

This is probably because this is internally cast to float, because the cython implementation expects floats.

This is probably a duplicate of #11446

@phofl phofl added Closing Candidate May be closeable, needs more eyeballs Window rolling, ewma, expanding Duplicate Report Duplicate issue or pull request and removed Needs Triage Issue that has not been reviewed by a pandas team member labels Feb 26, 2021
@phofl
Copy link
Member

phofl commented Feb 27, 2021

closing as duplicate

@phofl phofl closed this as completed Feb 27, 2021
@phofl phofl added this to the No action milestone Feb 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Closing Candidate May be closeable, needs more eyeballs Duplicate Report Duplicate issue or pull request Window rolling, ewma, expanding
Projects
None yet
Development

No branches or pull requests

2 participants