-
Notifications
You must be signed in to change notification settings - Fork 367
Fix the input check in groupby. #1824
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
Fix the input check in groupby. #1824
Conversation
| ) | ||
|
|
||
| # TODO: a pandas bug? | ||
| # expected = pdf.groupby((10, "a"))[(20, "c")].sum().sort_index() |
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.
nit of nit: one more space here in the comment 😅
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.
Anyway, pdf.groupby((10, "a"))[[(20, "c")]].sum() seems working.
>>> pdf
10 20 30
a b c d
0 1 4 4.0 a
1 2 2 2.0 b
3 6 7 7.0 c
5 4 3 3.0 d
6 4 3 NaN e
8 6 1 1.0 f
9 4 1 1.0 g
9 3 1 1.0 h
9 7 2 2.0 t
>>> pdf.groupby((10, "a"))[[(20, "c")]].sum()
20
c
(10, a)
1 4.0
2 2.0
3 1.0
4 4.0
6 8.0
7 2.0There 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.
Oh, Sorry. nvm above. It's different from pdf.groupby((10, "a"))[(20, "c")].sum() anyway.
| self.assertRaises( | ||
| KeyError, | ||
| lambda: kdf.groupby(("B", "class"))[("A", "name")].get_group(["bird", "mammal"]), | ||
| ) |
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.
You removed because this is duplicated test with below ?
|
LGTM. Anyway I think it's good to merge regardless of two nit comments. |
Fixes the input check in
groupby.