@@ -1730,8 +1730,10 @@ class BaseGrouper(object):
1730
1730
1731
1731
Parameters
1732
1732
----------
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
1735
1737
for example for grouper list to groupby, need to pass the list
1736
1738
sort : boolean, default True
1737
1739
whether this grouper will give sorted result or not
@@ -1897,9 +1899,9 @@ def group_info(self):
1897
1899
comp_ids = _ensure_int64 (comp_ids )
1898
1900
return comp_ids , obs_group_ids , ngroups
1899
1901
1900
- # 17530
1901
1902
@cache_readonly
1902
1903
def label_info (self ):
1904
+ # return the labels of items in original grouped axis
1903
1905
labels , _ , _ = self .group_info
1904
1906
if self .indexer is not None :
1905
1907
sorter = np .lexsort ((labels , self .indexer ))
@@ -2319,16 +2321,19 @@ class BinGrouper(BaseGrouper):
2319
2321
2320
2322
Examples
2321
2323
--------
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',
2324
2326
'2005-01-05', '2005-01-07', '2005-01-09'],
2325
2327
dtype='datetime64[ns]', freq='2D')
2326
2328
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
+
2328
2332
(array([0, 0, 1, 1, 2, 2, 3, 3, 4, 4]), array([0, 1, 2, 3, 4]), 5)
2329
2333
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
2332
2337
2333
2338
"""
2334
2339
0 commit comments