Skip to content

Commit 4585246

Browse files
authored
asvs for normalize functions (#35221)
1 parent 283d672 commit 4585246

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed
+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
try:
2+
from pandas._libs.tslibs import normalize_i8_timestamps, is_date_array_normalized
3+
except ImportError:
4+
from pandas._libs.tslibs.conversion import (
5+
normalize_i8_timestamps,
6+
is_date_array_normalized,
7+
)
8+
9+
import pandas as pd
10+
11+
from .tslib import _sizes, _tzs
12+
13+
14+
class Normalize:
15+
params = [
16+
_sizes,
17+
_tzs,
18+
]
19+
param_names = ["size", "tz"]
20+
21+
def setup(self, size, tz):
22+
# use an array that will have is_date_array_normalized give True,
23+
# so we do not short-circuit early.
24+
dti = pd.date_range("2016-01-01", periods=10, tz=tz).repeat(size // 10)
25+
self.i8data = dti.asi8
26+
27+
def time_normalize_i8_timestamps(self, size, tz):
28+
normalize_i8_timestamps(self.i8data, tz)
29+
30+
def time_is_date_array_normalized(self, size, tz):
31+
# TODO: cases with different levels of short-circuiting
32+
is_date_array_normalized(self.i8data, tz)

0 commit comments

Comments
 (0)