পান্ডাসে CustomBusinessHour.end প্রোপার্টি ব্যবহার করে কাস্টম বিজনেস আওয়ারের শেষ সময় (২৪ ঘণ্টা ফরম্যাটে) দেখানো যায়।
প্রক্রিয়া
import pandas as pdtimestamp = pd.Timestamp('2021-11-14 05:20:30')cbhOffset = pd.tseries.offsets.CustomBusinessHour(start="09:30", end="18:30", n=5)- অফসেট যোগ করে আপডেটেড টাইমস্ট্যাম্প দেখুন।
cbhOffset.endদিয়ে এন্ড টাইম দেখুন।
উদাহরণ কোড
import pandas as pd
timestamp = pd.Timestamp('2021-11-14 05:20:30')
print("Timestamp...\n", timestamp)
cbhOffset = pd.tseries.offsets.CustomBusinessHour(start="09:30", end="18:30", n=5)
print("\nCustomBusinessHour Offset...\n", cbhOffset)
print("\nUpdated Timestamp...\n", timestamp + cbhOffset)
print("\nThe end time of the custom business hour...\n", cbhOffset.end)
আউটপুট
Timestamp... 2021-11-14 05:20:30 CustomBusinessHour Offset... <5 * CustomBusinessHours: CBH=09:30-18:30> Updated Timestamp... 2021-11-15 14:30:00 The end time of the custom business hour... (datetime.time(18, 30),)