-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: Runtime warning with groupby/tail when None
appears in group column
#46814
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 for the report! I'm not seeing this on main or 1.4.x; can you post the output of versions
|
Ah, my mistake, I can't reproduce on 1.4.x, so I must have messed up my test environment yesterday (sorry to omit
INSTALLED VERSIONS
------------------
commit : a8968bf
python : 3.8.8.final.0
python-bits : 64
OS : Linux
OS-release : 5.13.0-39-generic
Version : #44~20.04.1-Ubuntu SMP Thu Mar 24 16:43:35 UTC 2022
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8
pandas : 1.5.0.dev0+694.ga8968bfa69 |
Update: I ran a git bisect, and for me the warning starts to show up at 4d7a03a |
Thanks, I'm able to reproduce with numpy 1.21.6; no warning appears with numpy 1.22.0.This was a bug that fixed in 1.22.0: We could add a workaround to avoid the warning for numpy < 1.22 by computing a Boolean mask where the array is null. |
Thanks @rhshadrach! Upgrading numpy is a fine workaround from my perspective. |
Closing as it seems this was a numpy isssue |
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
👋 In pandas
main
, a groupby/tail on a DataFrame which contains nulls in the grouped column produces aRuntimeWarning
suggesting a mishandled case in indexing logic:If I set
dropna=False
, the snippet succeeds without producing a warning.Based on the warning location and git blame, it may be related to #42947
Expected Behavior
The above groupby should succeed without producing a warning.
Installed Versions
Pandas
main
, as well as 1.4.The text was updated successfully, but these errors were encountered: