@@ -1110,31 +1110,29 @@ def indices(self):
11101110
11111111 @cache_readonly
11121112 def group_info (self ) -> tuple [npt .NDArray [np .intp ], int ]:
1113- ngroups = self .ngroups
1114- rep = np .diff (np .r_ [0 , self .bins ])
1115-
1116- rep = ensure_platform_int (rep )
1117- if ngroups == len (self .bins ):
1118- comp_ids = np .repeat (np .arange (ngroups ), rep )
1119- else :
1120- comp_ids = np .repeat (np .r_ [- 1 , np .arange (ngroups )], rep )
1121-
1122- return (ensure_platform_int (comp_ids ), ngroups )
1123-
1124- @cache_readonly
1125- def result_index (self ) -> Index :
1126- if len (self .binlabels ) != 0 and isna (self .binlabels [0 ]):
1127- return self .binlabels [1 :]
1128-
1129- return self .binlabels
1113+ return self .ids , self .ngroups
11301114
11311115 @cache_readonly
11321116 def codes (self ) -> list [npt .NDArray [np .intp ]]:
11331117 return [self .ids ]
11341118
11351119 @cache_readonly
11361120 def result_index_and_ids (self ):
1137- return self .result_index , self .group_info [0 ]
1121+ result_index = self .binlabels
1122+ if len (self .binlabels ) != 0 and isna (self .binlabels [0 ]):
1123+ result_index = result_index [1 :]
1124+
1125+ ngroups = len (result_index )
1126+ rep = np .diff (np .r_ [0 , self .bins ])
1127+
1128+ rep = ensure_platform_int (rep )
1129+ if ngroups == len (self .bins ):
1130+ ids = np .repeat (np .arange (ngroups ), rep )
1131+ else :
1132+ ids = np .repeat (np .r_ [- 1 , np .arange (ngroups )], rep )
1133+ ids = ensure_platform_int (ids )
1134+
1135+ return result_index , ids
11381136
11391137 @property
11401138 def levels (self ) -> list [Index ]:
0 commit comments