(self, index, index_structure)
| 119 | param_names = ["index_dtype", "index_structure"] |
| 120 | |
| 121 | def setup(self, index, index_structure): |
| 122 | N = 10**6 |
| 123 | if index == "string": |
| 124 | index = Index([f"i-{i}" for i in range(N)], dtype=object) |
| 125 | elif index == "datetime": |
| 126 | index = date_range("1900", periods=N, freq="s") |
| 127 | elif index == "period": |
| 128 | index = period_range("1900", periods=N, freq="s") |
| 129 | index = index.sort_values() |
| 130 | assert index.is_unique and index.is_monotonic_increasing |
| 131 | if index_structure == "nonunique_monotonic_inc": |
| 132 | index = index.insert(item=index[2], loc=2)[:-1] |
| 133 | elif index_structure == "non_monotonic": |
| 134 | index = index[::2].append(index[1::2]) |
| 135 | assert len(index) == N |
| 136 | self.s = Series(np.random.rand(N), index=index) |
| 137 | self.lbl = index[80000] |
| 138 | # warm up index mapping |
| 139 | self.s[self.lbl] |
| 140 | |
| 141 | def time_getitem_label_slice(self, index, index_structure): |
| 142 | self.s[: self.lbl] |
nothing calls this directly
no test coverage detected