Sử dụng thuộc tính CustomBusinessHour.end để lấy giờ kết thúc của giờ làm việc tùy chỉnh (định dạng 24h).
Ví dụ
import pandas as pd
timestamp = pd.Timestamp('2021-11-14 05:20:30')
cbhOffset = pd.tseries.offsets.CustomBusinessHour(start="09:30", end="18:30", n=5)
print("Timestamp:", timestamp)
print("CustomBusinessHour Offset:", cbhOffset)
print("Updated Timestamp:", timestamp + cbhOffset)
print("End time:", cbhOffset.end)
Kết quả
Timestamp: 2021-11-14 05:20:30 CustomBusinessHour Offset: <5 * CustomBusinessHours: CBH=09:30-18:30> Updated Timestamp: 2021-11-15 14:30:00 End time: (datetime.time(18, 30),)