File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -132,16 +132,18 @@ def setup(self):
132
132
ncats = 100
133
133
134
134
self .s_str = pd .Series (tm .makeCategoricalIndex (N , ncats )).astype (str )
135
- self .s_str_cat = self .s_str . astype ( 'category' )
135
+ self .s_str_cat = pd . Series ( self .s_str , dtype = 'category' )
136
136
with warnings .catch_warnings (record = True ):
137
- self .s_str_cat_ordered = self .s_str .astype ('category' ,
138
- ordered = True )
137
+ str_cat_type = pd .CategoricalDtype (set (self .s_str ),
138
+ ordered = True )
139
+ self .s_str_cat_ordered = self .s_str .astype (str_cat_type )
139
140
140
141
self .s_int = pd .Series (np .random .randint (0 , ncats , size = N ))
141
- self .s_int_cat = self .s_int . astype ( 'category' )
142
+ self .s_int_cat = pd . Series ( self .s_int , dtype = 'category' )
142
143
with warnings .catch_warnings (record = True ):
143
- self .s_int_cat_ordered = self .s_int .astype ('category' ,
144
- ordered = True )
144
+ int_cat_type = pd .Categorical (set (self .s_int ),
145
+ ordered = True )
146
+ self .s_int_cat_ordered = self .s_int .astype (int_cat_type )
145
147
146
148
def time_rank_string (self ):
147
149
self .s_str .rank ()
You can’t perform that action at this time.
0 commit comments