-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: Fix groupby nunique with NaT #17624
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
Conversation
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.
lgtm modulo some minor comments. ping on green.
pandas/tests/groupby/test_groupby.py
Outdated
@@ -3688,6 +3688,18 @@ def test_nunique_with_timegrouper(self): | |||
)['data'].apply(pd.Series.nunique) | |||
tm.assert_series_equal(result, expected) | |||
|
|||
def test_nunique_with_timegrouper_and_nat(self): | |||
test = pd.DataFrame({ |
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.
add the github issue number as a comment.
move this test to test_timegrouper.py (same dir)
@@ -3177,7 +3177,11 @@ def nunique(self, dropna=True): | |||
|
|||
out = np.add.reduceat(inc, idx).astype('int64', copy=False) | |||
if len(ids): | |||
res = out if ids[0] != -1 else out[1:] |
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.
can you add a helpful comment here on what is happening
Codecov Report
@@ Coverage Diff @@
## master #17624 +/- ##
==========================================
- Coverage 91.2% 91.18% -0.02%
==========================================
Files 163 163
Lines 49637 49640 +3
==========================================
- Hits 45269 45263 -6
- Misses 4368 4377 +9
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #17624 +/- ##
==========================================
- Coverage 91.2% 91.18% -0.02%
==========================================
Files 163 163
Lines 49637 49655 +18
==========================================
+ Hits 45269 45276 +7
- Misses 4368 4379 +11
Continue to review full report at Codecov.
|
@jreback Thanks for your review. All is now fixed! |
thanks @Licht-T nice patch! keep em coming! |
git diff upstream/master -u -- "*.py" | flake8 --diff