File tree 1 file changed +13
-6
lines changed
1 file changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -223,12 +223,19 @@ class CategoricalSlicing(object):
223
223
224
224
def setup (self , index ):
225
225
N = 10 ** 6
226
- values = list ('a' * N + 'b' * N + 'c' * N )
227
- indices = {
228
- 'monotonic_incr' : pd .Categorical (values ),
229
- 'monotonic_decr' : pd .Categorical (reversed (values )),
230
- 'non_monotonic' : pd .Categorical (list ('abc' * N ))}
231
- self .data = indices [index ]
226
+ categories = ['a' , 'b' , 'c' ]
227
+ values = [0 ] * N + [1 ] * N + [2 ] * N
228
+ if index == 'monotonic_incr' :
229
+ self .data = pd .Categorical .from_codes (values ,
230
+ categories = categories )
231
+ elif index == 'monotonic_decr' :
232
+ self .data = pd .Categorical .from_codes (list (reversed (values )),
233
+ categories = categories )
234
+ elif index == 'non_monotonic' :
235
+ self .data = pd .Categorical .from_codes ([0 , 1 , 2 ] * N ,
236
+ categories = categories )
237
+ else :
238
+ raise ValueError ('Invalid index param: {}' .format (index ))
232
239
233
240
self .scalar = 10000
234
241
self .list = list (range (10000 ))
You can’t perform that action at this time.
0 commit comments