-
-
Notifications
You must be signed in to change notification settings - Fork 18.2k
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 : ValueError in case on NaN value in groupby columns #24850
Changes from 3 commits
65d05f7
ee1c9af
16531ec
0fe8678
e397a5a
e2badda
8d5b896
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -420,6 +420,18 @@ def test_observed_groups(observed): | |
tm.assert_dict_equal(result, expected) | ||
|
||
|
||
def test_observed_groups_with_nan(): | ||
# GH 24740 | ||
df = pd.DataFrame({'cat': pd.Categorical(['a', 'c', 'a'], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you make this |
||
categories=['a', 'b', 'd', 'e', 'f']), | ||
'vals': [1, 2, 3]}) | ||
|
||
g = df.groupby('cat', observed=True) | ||
result = g.groups | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. use the observed fixture here to test both cases |
||
expected = {'a': Index([0, 2], dtype='int64')} | ||
tm.assert_dict_equal(result, expected) | ||
|
||
|
||
def test_datetime(): | ||
# GH9049: ensure backward compatibility | ||
levels = pd.date_range('2014-01-01', periods=4) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pandas.core.groupby.groups
isn't a method. How about just "Bug in groupby causing aValueError
if ..."