(self)
| 42 | |
| 43 | class Query: |
| 44 | def setup(self): |
| 45 | N = 10**6 |
| 46 | halfway = (N // 2) - 1 |
| 47 | index = pd.date_range("20010101", periods=N, freq="min") |
| 48 | s = pd.Series(index) |
| 49 | self.ts = s.iloc[halfway] |
| 50 | self.df = pd.DataFrame({"a": np.random.randn(N), "dates": index}, index=index) |
| 51 | data = np.random.randn(N) |
| 52 | self.min_val = data.min() |
| 53 | self.max_val = data.max() |
| 54 | |
| 55 | def time_query_datetime_index(self): |
| 56 | self.df.query("index < @self.ts") |