-
- Notifications
You must be signed in to change notification settings - Fork 19.3k
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
Changes from 1 commit
6838d9c 66febe4 0ff386f 00a18e3 cc1a4ac 6927207 3ce56bd 737c00e b868cbc 950de20 File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
… if needed, eg. build grouping labels
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| | @@ -1730,13 +1730,14 @@ class BaseGrouper(object): | |
| """ | ||
| | ||
| def __init__(self, axis, groupings, sort=True, group_keys=True, | ||
| mutated=False): | ||
| mutated=False, indexer=None): | ||
| self._filter_empty_groups = self.compressed = len(groupings) != 1 | ||
| self.axis = axis | ||
| self.groupings = groupings | ||
| self.sort = sort | ||
| self.group_keys = group_keys | ||
| self.mutated = mutated | ||
| self.indexer = indexer | ||
| | ||
| @property | ||
| def shape(self): | ||
| | @@ -2282,11 +2283,12 @@ def generate_bins_generic(values, binner, closed): | |
| | ||
| class BinGrouper(BaseGrouper): | ||
| | ||
| def __init__(self, bins, binlabels, filter_empty=False, mutated=False): | ||
| def __init__(self, bins, binlabels, filter_empty=False, mutated=False, indexer=None): | ||
| self.bins = _ensure_int64(bins) | ||
| self.binlabels = _ensure_index(binlabels) | ||
| self._filter_empty_groups = filter_empty | ||
| self.mutated = mutated | ||
| self.indexer = indexer | ||
| | ||
| @cache_readonly | ||
| def groups(self): | ||
| | @@ -2554,6 +2556,9 @@ def _make_labels(self): | |
| if isinstance(self.grouper, BaseGrouper): | ||
| Contributor 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 | ||
| 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) | ||
| | ||
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 doc-string explaining params (I know you just added 1 but good time)
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.
I'm sorry I don't really understand all parameters, I've added those I know😂