MCPcopy
hub / github.com/pandas-dev/pandas / setup

Method setup

asv_bench/benchmarks/indexing_engines.py:178–189  ·  view source on GitHub ↗
(self, index_type)

Source from the content-addressed store, hash-verified

176 param_names = ["index_type"]
177
178 def setup(self, index_type):
179 N = 10**5
180 values = list("a" * N + "b" * N + "c" * N)
181 arr = {
182 "monotonic_incr": np.array(values, dtype=object),
183 "monotonic_decr": np.array(list(reversed(values)), dtype=object),
184 "non_monotonic": np.array(list("abc") * N, dtype=object),
185 }[index_type]
186
187 self.data = libindex.ObjectEngine(arr)
188 # code below avoids populating the mapping etc. while timing.
189 self.data.get_loc("b")
190
191 def time_get_loc(self, index_type):
192 self.data.get_loc("b")

Callers

nothing calls this directly

Calls 2

arrayMethod · 0.45
get_locMethod · 0.45

Tested by

no test coverage detected