-
-
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: groupby resample different results with .agg() vs .mean() #37905
Merged
jreback
merged 15 commits into
pandas-dev:master
from
jalmaguer:fix-groubpy-resampling-bug
Dec 22, 2020
Merged
Changes from 9 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
d9579bc
BUG: fix GH33548
jalmaguer 922af24
reformat test_resampler_grouper.by using black
jalmaguer 1634a28
fix mypy failure
jalmaguer 0e1806f
undo mypy ignore comments since it breaks flake8
jalmaguer 7134d7c
make requested changes to whatsnew/v1.2.0.rst
jalmaguer 34e00be
fix mypy issues and add some comments
jalmaguer 6ecbf4e
add grouper_resorted attribute to TimeGrouper
jalmaguer 49063c9
set self._grouper = None in Grouper init
jalmaguer ed8a5ca
set grouper_resorted attribute on Grouper instead of TimeGrouper to f…
jalmaguer e66712b
get rid of grouper_resorted attribute and use _indexer is not None as…
jalmaguer d4750a1
Merge branch 'master' into fix-groubpy-resampling-bug
jalmaguer 81bbc17
remove unnecessary assert on self._indexer
jalmaguer 86b070f
Merge branch 'master' into fix-groubpy-resampling-bug
jalmaguer 59bafda
Merge branch 'master' into fix-groubpy-resampling-bug
jalmaguer 7c2bf5d
Merge branch 'master' into fix-groubpy-resampling-bug
jalmaguer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 track down exactly how this happens, this is a real problem, somthing is keeping state and now we are undoing it. Your fix is pretty clean, but this makes reasoning very about this very hard.
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.
It’s very complicated and you have to dig through a stack trace that is 18 method calls deep to understand it but I believe it’s because self._grouper which is meant to be the TimeGrouper though in this case is actually just a sorted DatetimeIndex is always sorted and obj if you go up the stack trace you’ll see that it is coming from a SeriesGroupby._selected_obj which I’m guessing just doesn’t get sorted when it’s created. The case where self._grouper has not been resorted I believe only happens when the dates were already in order and don’t need to be resorted.