@@ -723,8 +723,8 @@ def _get_splitter(self, data: FrameOrSeries, axis: int = 0) -> DataSplitter:
723
723
724
724
__finalize__ has not been called for the subsetted objects returned.
725
725
"""
726
- comp_ids , _ , ngroups = self .group_info
727
- return get_splitter (data , comp_ids , ngroups , axis = axis )
726
+ ids , _ , ngroups = self .group_info
727
+ return get_splitter (data , ids , ngroups , axis = axis )
728
728
729
729
def _get_grouper (self ):
730
730
"""
@@ -740,10 +740,10 @@ def _get_group_keys(self):
740
740
if len (self .groupings ) == 1 :
741
741
return self .levels [0 ]
742
742
else :
743
- comp_ids , _ , ngroups = self .group_info
743
+ ids , _ , ngroups = self .group_info
744
744
745
745
# provide "flattened" iterator for multi-group setting
746
- return get_flattened_list (comp_ids , ngroups , self .levels , self .codes )
746
+ return get_flattened_list (ids , ngroups , self .levels , self .codes )
747
747
748
748
@final
749
749
def apply (self , f : F , data : FrameOrSeries , axis : int = 0 ):
@@ -846,9 +846,9 @@ def size(self) -> Series:
846
846
"""
847
847
Compute group sizes.
848
848
"""
849
- ids , _ , ngroup = self .group_info
850
- if ngroup :
851
- out = np .bincount (ids [ids != - 1 ], minlength = ngroup )
849
+ ids , _ , ngroups = self .group_info
850
+ if ngroups :
851
+ out = np .bincount (ids [ids != - 1 ], minlength = ngroups )
852
852
else :
853
853
out = []
854
854
return Series (out , index = self .result_index , dtype = "int64" )
@@ -882,11 +882,11 @@ def group_info(self):
882
882
@cache_readonly
883
883
def codes_info (self ) -> np .ndarray :
884
884
# return the codes of items in original grouped axis
885
- codes , _ , _ = self .group_info
885
+ ids , _ , _ = self .group_info
886
886
if self .indexer is not None :
887
- sorter = np .lexsort ((codes , self .indexer ))
888
- codes = codes [sorter ]
889
- return codes
887
+ sorter = np .lexsort ((ids , self .indexer ))
888
+ ids = ids [sorter ]
889
+ return ids
890
890
891
891
@final
892
892
def _get_compressed_codes (self ) -> tuple [np .ndarray , np .ndarray ]:
@@ -906,8 +906,8 @@ def ngroups(self) -> int:
906
906
@property
907
907
def reconstructed_codes (self ) -> list [np .ndarray ]:
908
908
codes = self .codes
909
- comp_ids , obs_ids , _ = self .group_info
910
- return decons_obs_group_ids (comp_ids , obs_ids , self .shape , codes , xnull = True )
909
+ ids , obs_ids , _ = self .group_info
910
+ return decons_obs_group_ids (ids , obs_ids , self .shape , codes , xnull = True )
911
911
912
912
@cache_readonly
913
913
def result_index (self ) -> Index :
@@ -954,13 +954,13 @@ def _cython_operation(
954
954
955
955
cy_op = WrappedCythonOp (kind = kind , how = how )
956
956
957
- comp_ids , _ , _ = self .group_info
957
+ ids , _ , _ = self .group_info
958
958
ngroups = self .ngroups
959
959
return cy_op .cython_operation (
960
960
values = values ,
961
961
axis = axis ,
962
962
min_count = min_count ,
963
- comp_ids = comp_ids ,
963
+ comp_ids = ids ,
964
964
ngroups = ngroups ,
965
965
** kwargs ,
966
966
)
@@ -997,26 +997,26 @@ def _aggregate_series_fast(
997
997
# - ngroups != 0
998
998
func = com .is_builtin_func (func )
999
999
1000
- group_index , _ , ngroups = self .group_info
1000
+ ids , _ , ngroups = self .group_info
1001
1001
1002
1002
# avoids object / Series creation overhead
1003
- indexer = get_group_index_sorter (group_index , ngroups )
1003
+ indexer = get_group_index_sorter (ids , ngroups )
1004
1004
obj = obj .take (indexer )
1005
- group_index = group_index .take (indexer )
1006
- sgrouper = libreduction .SeriesGrouper (obj , func , group_index , ngroups )
1005
+ ids = ids .take (indexer )
1006
+ sgrouper = libreduction .SeriesGrouper (obj , func , ids , ngroups )
1007
1007
result , counts = sgrouper .get_result ()
1008
1008
return result , counts
1009
1009
1010
1010
@final
1011
1011
def _aggregate_series_pure_python (self , obj : Series , func : F ):
1012
- group_index , _ , ngroups = self .group_info
1012
+ ids , _ , ngroups = self .group_info
1013
1013
1014
1014
counts = np .zeros (ngroups , dtype = int )
1015
1015
result = np .empty (ngroups , dtype = "O" )
1016
1016
initialized = False
1017
1017
1018
1018
# equiv: splitter = self._get_splitter(obj, axis=0)
1019
- splitter = get_splitter (obj , group_index , ngroups , axis = 0 )
1019
+ splitter = get_splitter (obj , ids , ngroups , axis = 0 )
1020
1020
1021
1021
for i , group in enumerate (splitter ):
1022
1022
@@ -1152,7 +1152,7 @@ def indices(self):
1152
1152
@cache_readonly
1153
1153
def group_info (self ):
1154
1154
ngroups = self .ngroups
1155
- obs_group_ids = np .arange (ngroups )
1155
+ obs_group_ids = np .arange (ngroups , dtype = np . int64 )
1156
1156
rep = np .diff (np .r_ [0 , self .bins ])
1157
1157
1158
1158
rep = ensure_platform_int (rep )
@@ -1163,7 +1163,7 @@ def group_info(self):
1163
1163
1164
1164
return (
1165
1165
ensure_platform_int (comp_ids ),
1166
- obs_group_ids . astype ( "int64" , copy = False ) ,
1166
+ obs_group_ids ,
1167
1167
ngroups ,
1168
1168
)
1169
1169
0 commit comments