8000 BUG:Time Grouper bug fix when applied for list groupers by ruiann · Pull Request #17587 · pandas-dev/pandas · GitHub
[go: up one dir, main page]

Skip to content

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 10 commits into from
Oct 1, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
new method for BaseGrouper and inherited class
  • Loading branch information
ruiann authored and jreback committed Oct 1, 2017
commit 6927207f9a444c25e8569f3b5d04a7b920f5af5a
14 changes: 10 additions & 4 deletions pandas/core/groupby.py
Original file line number Diff line number Diff line change
Expand Up @@ -1897,6 +1897,15 @@ def group_info(self):
comp_ids = _ensure_int64(comp_ids)
return comp_ids, obs_group_ids, ngroups

# 17530
Copy link
Contributor

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)

@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:
Expand Down 8E41 Expand Up @@ -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):
Copy link
Contributor

Choose a reason for hiding this comment

The 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)
Expand Down
0