BusinessHour ऑफ़सेट ऑब्जेक्ट पर लागू आवृत्ति का नाम प्राप्त करें
Pandas में BusinessHour.name प्रॉपर्टी का उपयोग करके ऑफ़सेट पर लागू आवृत्ति का नाम प्राप्त किया जा सकता है।
आवश्यक लाइब्रेरी आयात करें
import pandas as pd
टाइमस्टैम्प ऑब्जेक्ट सेट करें
timestamp = pd.Timestamp('2021-1-1 01:55:30')
BusinessHour ऑफ़सेट बनाएँ
bhOffset = pd.tseries.offsets.BusinessHour(start="09:30", end="18:00")
अपडेटेड टाइमस्टैम्प प्रदर्शित करें
print("\nUpdated Timestamp...\n", timestamp + bhOffset)
आवृत्ति का नाम प्राप्त करें
print("\nThe name of the frequency on the BusinessHour object..\n", bhOffset.name)
पूर्ण उदाहरण
import pandas as pd
# टाइमस्टैम्प सेट करें
timestamp = pd.Timestamp('2021-1-1 01:55:30')
print("Timestamp...\n", timestamp)
# BusinessHour ऑफ़सेट बनाएँ
bhOffset = pd.tseries.offsets.BusinessHour(start="09:30", end="18:00")
# ऑफ़सेट प्रदर्शित करें
print("\nBusinessHour Offset...\n", bhOffset)
# अपडेटेड टाइमस्टैम्प
print("\nUpdated Timestamp...\n", timestamp + bhOffset)
# आवृत्ति का नाम प्राप्त करें
print("\nThe name of the frequency on the BusinessHour object..\n", bhOffset.name)
आउटपुट
Timestamp...
2021-01-01 01:55:30
BusinessHour Offset...
<BusinessHour: BH=09:30-18:00>
Updated Timestamp...
2021-01-01 10:30:00
The name of the frequency on the BusinessHour object.. BH
व्याख्या
nameप्रॉपर्टी आवृत्ति का वर्णनात्मक नाम लौटाती है- BusinessHour के लिए यह
'BH'लौटाता है rule_codeऔरnameअक्सर समान मान लौटाते हैं