-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: rolling() function does not work with Float64 columns with missing values #43381
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
Thanks @janlugt for the report. on master, this no longer raises but does not give the expected dtype. The result is
|
@mroeschke made an issue about this as this is a breaking change |
Float64 is still experimental? we can fix this? |
Yes this repurposed issue, #11446, is about having rolling operations return the same dtype as the caller (if possible). The docstrings and this windowing section document that these windowing operations always return Since this overlaps with #11446, going to close in favor of that issue, but definitely possible to support |
Thanks for looking into this. I'll test my code with 1.3.3 when it comes out later this month (according to https://pandas.pydata.org/pandas-docs/dev/whatsnew/v1.3.3.html). |
@janlugt I didn't test with 1.3.x, #43381 (comment) was with master, so may not work with 1.3.3 unless the commit that fixed was backported. |
I'm coming to this issue with very little expertise (coming from R and Julia): created a variable by dividing one
|
fixed by #43174, 1.4.0 release candidate expected next month with release in early January. Please feel free to evaluate the release candidate when available or checkout the nightly builds to confirm this fixes the issue. |
Great, thank you so much Simon! |
Hi, I think this bug still exists (in
|
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
Simple series with floats, dtype float64:
diff() introduces a NaN in the first position:
This works as expected:
We can cast to a Float64:
diff() still works fine, but gives us a pd.NA instead of a NaN:
Now, when we call rolling(), everything comes tumbling down:
Problem description
My expectation would be that whether we call rolling on a float64 or a Float64 series, the output would be the same. The promise of pd.NA is that it can be used consistently across data types, and make the use of specific NaN types such as np.nan or NaT unnecessary, which is clearly not the case here.
Expected Output
Output of
pd.show_versions()
INSTALLED VERSIONS
commit : 5f648bf
python : 3.8.10.final.0
python-bits : 64
OS : Linux
OS-release : 5.10.16.3-microsoft-standard-WSL2
Version : #1 SMP Fri Apr 2 22:23:49 UTC 2021
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : C.UTF-8
LOCALE : en_US.UTF-8
pandas : 1.3.2
numpy : 1.21.1
pytz : 2021.1
dateutil : 2.8.1
pip : 21.2.4
setuptools : 57.0.0
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
fsspec : None
fastparquet : None
gcsfs : None
matplotlib : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pyxlsb : None
s3fs : None
scipy : 1.6.2
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None
numba : None
The text was updated successfully, but these errors were encountered: