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: ewm.sum() gives incorrect values when used with halflife parameter #51695
Comments
The docs say about
It looks like in your example it just sets |
Hi @topper-123 , I would love to work on this issue. Going through the files and potential fix for it. |
take |
Hi @lithomas1 , Could you review and confirm if this is a bug worth working on? If yes, I will go ahead. |
Sure, go for it. |
…m and times (pandas-dev#57225) * BUG: Raise if an aggregation function other than mean is used with ewm (pandas-dev#51695) * python 3.9 and mypy issue
…m and times (pandas-dev#57225) * BUG: Raise if an aggregation function other than mean is used with ewm (pandas-dev#51695) * python 3.9 and mypy issue
Pandas version checks
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 main branch of pandas.
Reproducible Example
Issue Description
pd.ewm.sum() does not use halflife parameter.
As I understand it, there are two series held inside ewm: the data values and the weights. The .sum() function should contain the sum of the products of the data values with their weights.
Expected Behavior
For the first example I expected:
1.01.0 = 1
1.00.5 + 0.01.0 = 0.5 (1 half life)
1.00.125 + 0.0 * 0.5 + 0.0 *1.0 = 0.125 (3 half lifes) - here ewm returns 0.25 instead of 0.125
For the second example I expected:
1.0
0.9999
0.9999
since the half life is 5 days and only a few seconds have elapsed.
Installed Versions
pandas : 1.5.3
numpy : 1.24.2
pytz : 2022.7.1
dateutil : 2.8.2
setuptools : 65.6.3
pip : 23.0.1
Cython : None
pytest : None
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
brotli : None
fastparquet : None
fsspec : None
gcsfs : None
matplotlib : None
numba : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pyreadstat : None
pyxlsb : None
s3fs : None
scipy : None
snappy : None
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None
zstandard : None
tzdata : None
The text was updated successfully, but these errors were encountered: