Sử dụng thuộc tính CustomBusinessHour.normalize để kiểm tra xem offset có được chuẩn hóa (đặt giờ về 00:00:00) hay không.
Ví dụ
import pandas as pd
timestamp = pd.Timestamp('2021-10-25 08:35:10')
cbhOffset = pd.tseries.offsets.CustomBusinessHour(n=3, weekmask='Mon Tue Wed Fri Sat', normalize=True)
print("Timestamp:", timestamp)
print("CustomBusinessHour Offset:", cbhOffset)
print("Updated Timestamp:", timestamp + cbhOffset)
print("Frequency string:", cbhOffset.freqstr)
print("Name:", cbhOffset.name)
print("Normalized:", cbhOffset.normalize)
Kết quả
Timestamp: 2021-10-25 08:35:10 CustomBusinessHour Offset: <3 * CustomBusinessHours: CBH=09:00-17:00> Updated Timestamp: 2021-10-25 00:00:00 Frequency string: 3CBH Name: CBH Normalized: True