File tree 1 file changed +5
-8
lines changed
1 file changed +5
-8
lines changed Original file line number Diff line number Diff line change 23
23
Period ,
24
24
Timedelta ,
25
25
Timestamp ,
26
+ periods_per_second ,
26
27
to_offset ,
27
28
)
29
+ from pandas ._libs .tslibs .dtypes import abbrev_to_npy_unit
28
30
from pandas ._typing import (
29
31
AnyArrayLike ,
30
32
Axis ,
@@ -2130,14 +2132,9 @@ def _adjust_dates_anchored(
2130
2132
if offset is not None :
2131
2133
offset = offset .as_unit (unit )
2132
2134
2133
- # TODO is there anything which can be reused here?
2134
- freq_value = freq .nanos
2135
- if unit == "us" :
2136
- freq_value = freq_value // 1_000
2137
- elif unit == "ms" :
2138
- freq_value = freq_value // 1_000_000
2139
- elif unit == "s" :
2140
- freq_value = freq_value // 1_000_000_000
2135
+ freq_value = freq .nanos // (
2136
+ 1_000_000_000 // periods_per_second (abbrev_to_npy_unit (unit ))
2137
+ )
2141
2138
2142
2139
origin_timestamp = 0 # origin == "epoch"
2143
2140
if origin == "start_day" :
You can’t perform that action at this time.
0 commit comments