Skip to content

Commit d33c5be

Browse files
committed
adding shuffled test cases
1 parent ba970d4 commit d33c5be

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

asv_bench/benchmarks/hash_functions.py

+22-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,28 @@ class NumericSeriesIndexing:
135135
param_names = ["index_dtype", "N"]
136136

137137
def setup(self, index, N):
138-
indices = index(list(range(55)) + [54] + list(range(55, N - 1)))
138+
vals = np.array(list(range(55)) + [54] + list(range(55, N - 1)))
139+
indices = index(vals)
140+
self.data = pd.Series(np.arange(N), index=indices)
141+
142+
def time_loc_slice(self, index, N):
143+
# trigger building of mapping
144+
self.data.loc[:800]
145+
146+
147+
class NumericSeriesIndexingShuffled:
148+
149+
params = [
150+
(pd.Int64Index, pd.UInt64Index, pd.Float64Index),
151+
(10 ** 4, 10 ** 5, 5 * 10 ** 5, 10 ** 6, 5 * 10 ** 6),
152+
]
153+
param_names = ["index_dtype", "N"]
154+
155+
def setup(self, index, N):
156+
vals = np.array(list(range(55)) + [54] + list(range(55, N - 1)))
157+
np.random.seed(42)
158+
np.random.shuffle(vals)
159+
indices = index(vals)
139160
self.data = pd.Series(np.arange(N), index=indices)
140161

141162
def time_loc_slice(self, index, N):

0 commit comments

Comments
 (0)