def setup(self, index_type): N = 10**5 values = list("a" * N + "b" * N + "c" * N) arr = { "monotonic_incr": np.array(values, dtype=object), "monotonic_decr": np.array(list(reversed(values)), dtype=object), "non_monotonic": np.array(list("abc") * N, dtype=object), }[index_type] self.data = libindex.ObjectEngine(lambda: arr, len(arr)) # code belows avoids populating the mapping etc. while timing. self.data.get_loc("b")
def setup(self, index_type): N = 10**5 values = list('a' * N + 'b' * N + 'c' * N) arr = { 'monotonic_incr': np.array(values, dtype=object), 'monotonic_decr': np.array(list(reversed(values)), dtype=object), 'non_monotonic': np.array(list('abc') * N, dtype=object), }[index_type] self.data = libindex.ObjectEngine(lambda: arr, len(arr)) # code belows avoids populating the mapping etc. while timing. self.data.get_loc('b')