Skip to content

Commit 31feb1b

Browse files
committed
comment
1 parent f83a0d5 commit 31feb1b

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

pandas/core/groupby.py

+13-8
Original file line numberDiff line numberDiff line change
@@ -1730,8 +1730,10 @@ class BaseGrouper(object):
17301730
17311731
Parameters
17321732
----------
1733-
axis : the axis to group
1734-
groupings : all the grouping instances to handle in this grouper
1733+
axis : int
1734+
the axis to group
1735+
groupings : array of grouping
1736+
all the grouping instances to handle in this grouper
17351737
for example for grouper list to groupby, need to pass the list
17361738
sort : boolean, default True
17371739
whether this grouper will give sorted result or not
@@ -1897,9 +1899,9 @@ def group_info(self):
18971899
comp_ids = _ensure_int64(comp_ids)
18981900
return comp_ids, obs_group_ids, ngroups
18991901

1900-
# 17530
19011902
@cache_readonly
19021903
def label_info(self):
1904+
# return the labels of items in original grouped axis
19031905
labels, _, _ = self.group_info
19041906
if self.indexer is not None:
19051907
sorter = np.lexsort((labels, self.indexer))
@@ -2319,16 +2321,19 @@ class BinGrouper(BaseGrouper):
23192321
23202322
Examples
23212323
--------
2322-
bins is [2, 4, 6, 8, 10]
2323-
binlabels is DatetimeIndex(['2005-01-01', '2005-01-03',
2324+
bins: [2, 4, 6, 8, 10]
2325+
binlabels: DatetimeIndex(['2005-01-01', '2005-01-03',
23242326
'2005-01-05', '2005-01-07', '2005-01-09'],
23252327
dtype='datetime64[ns]', freq='2D')
23262328
2327-
then the group_info is
2329+
the group_info, which contains the label of each item in grouped
2330+
axis, the index of label in label list, group number, is
2331+
23282332
(array([0, 0, 1, 1, 2, 2, 3, 3, 4, 4]), array([0, 1, 2, 3, 4]), 5)
23292333
2330-
means the label of each item in axis, the index of label in label
2331-
list, group number
2334+
means that, the grouped axis has 10 items, can be grouped into 5
2335+
labels, the first and second items belong to the first label, the
2336+
third and forth items belong to the second label, and so on
23322337
23332338
"""
23342339

0 commit comments

Comments
 (0)