-
-
Notifications
You must be signed in to change notification settings - Fork 18.7k
BUG:Time Grouper bug fix when applied for list groupers #17587
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
6838d9c
use grouper if given the list if grouper
ruiann 66febe4
BinGrouper holds the sorted binners, give the indexer to reorder axis…
ruiann 0ff386f
PEP8 fix
ruiann 00a18e3
PEP8 & comment
ruiann cc1a4ac
comment
ruiann 6927207
new method for BaseGrouper and inherited class
ruiann 3ce56bd
comment
ruiann 737c00e
move test to test time grouper
ruiann b868cbc
update whatsnew entry
ruiann 950de20
fixups
jreback 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
new method for BaseGrouper and inherited class
- Loading branch information
There are no files selected for viewing
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1897,6 +1897,15 @@ def group_info(self): | |
comp_ids = _ensure_int64(comp_ids) | ||
return comp_ids, obs_group_ids, ngroups | ||
|
||
# 17530 | ||
@cache_readonly | ||
def label_info(self): | ||
labels, _, _ = self.group_info | ||
if self.indexer is not None: | ||
sorter = np.lexsort((labels, self.indexer)) | ||
labels = labels[sorter] | ||
return labels | ||
|
||
def _get_compressed_labels(self): | ||
all_labels = [ping.labels for ping in self.groupings] | ||
if len(all_labels) > 1: | ||
|
@@ -2596,11 +2605,8 @@ def _make_labels(self): | |
if self._labels is None or self._group_index is None: | ||
# for the situation of groupby list of groupers | ||
if isinstance(self.grouper, BaseGrouper): | ||
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. same |
||
labels, _, _ = self.grouper.group_info | ||
labels = self.grouper.label_info | ||
uniques = self.grouper.result_index | ||
if self.grouper.indexer is not None: | ||
sorter = np.lexsort((labels, self.grouper.indexer)) | ||
labels = labels[sorter] | ||
else: | ||
labels, uniques = algorithms.factorize( | ||
self.grouper, sort=self.sort) | ||
|
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.
put a comment / doc-string inside the function on what this is doing(don't need to add the issue number)