@@ -1110,31 +1110,29 @@ def indices(self):
1110
1110
1111
1111
@cache_readonly
1112
1112
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
1130
1114
1131
1115
@cache_readonly
1132
1116
def codes (self ) -> list [npt .NDArray [np .intp ]]:
1133
1117
return [self .ids ]
1134
1118
1135
1119
@cache_readonly
1136
1120
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
1138
1136
1139
1137
@property
1140
1138
def levels (self ) -> list [Index ]:
0 commit comments