পান্ডাসে CustomBusinessHour.rule_code প্রোপার্টি ব্যবহার করে কাস্টম বিজনেস আওয়ার অফসেটে প্রয়োগ করা ফ্রিকোয়েন্সি রুল কোড বের করা যায়।
প্রক্রিয়া
import pandas as pdtimestamp = pd.Timestamp('2021-11-14 05:20:30')cbhOffset = pd.tseries.offsets.CustomBusinessHour(n=4, weekmask='Mon Tue Wed Fri Sat', normalize=True)- অফসেট যোগ করে আপডেটেড টাইমস্ট্যাম্প দেখুন।
cbhOffset.rule_codeদিয়ে রুল কোড দেখুন।
উদাহরণ কোড
import pandas as pd
timestamp = pd.Timestamp('2021-11-14 05:20:30')
print("Timestamp...\n", timestamp)
cbhOffset = pd.tseries.offsets.CustomBusinessHour(n=4, weekmask='Mon Tue Wed Fri Sat', normalize=True)
print("\nCustomBusinessHour Offset...\n", cbhOffset)
print("\nUpdated Timestamp...\n", timestamp + cbhOffset)
print("\nFrequency applied on the given CustomBusinessHour Offset object...\n", cbhOffset.freqstr)
print("\nThe rule code of the CustomBusinessHour object..\n", cbhOffset.rule_code)
আউটপুট
Timestamp... 2021-11-14 05:20:30 CustomBusinessHour Offset... <4 * CustomBusinessHours: CBH=09:00-17:00> Updated Timestamp... 2021-11-15 00:00:00 Frequency applied on the given CustomBusinessHour Offset object... 4CBH The rule code of the CustomBusinessHour object.. CBH