প্রদত্ত বিজনেসডে অফসেট অবজেক্টে প্রয়োগ করা কীওয়ার্ড আর্গুমেন্টগুলি প্রদর্শন করতে, পান্ডাসে BusinessDay.kwds সম্পত্তি ব্যবহার করুন৷
প্রথমে, প্রয়োজনীয় লাইব্রেরিগুলি আমদানি করুন -
import datetime import pandas as pd
পান্ডাস-
-এ টাইমস্ট্যাম্প অবজেক্ট সেট করুনtimestamp = pd.Timestamp('2021-10-30 01:55:02.000045')
বিজনেস ডে অফসেট তৈরি করুন। ব্যবসা দিবস হল তারিখ অফসেট সাবক্লাস −
bdOffset = pd.tseries.offsets.BusinessDay(offset = datetime.timedelta(hours = 7, minutes = 7))
আপডেট করা টাইমস্ট্যাম্প −
প্রদর্শন করুনprint("\nUpdated Timestamp...\n",timestamp + bdOffset)
কীওয়ার্ড আর্গুমেন্ট প্রদর্শন করুন −
print("\nKeyword arguments on the given BusinessDay Offset...\n",bdOffset.kwds) উদাহরণ
নিম্নলিখিত কোড -
import datetime
import pandas as pd
# Set the timestamp object in Pandas
timestamp = pd.Timestamp('2021-10-30 01:55:02.000045')
# Display the Timestamp
print("Timestamp...\n",timestamp)
# Create the BusinessDay Offset
# BusinessDay is the DateOffset subclass
bdOffset = pd.tseries.offsets.BusinessDay(offset = datetime.timedelta(hours = 7, minutes = 7))
# Display the BusinessDay Offset
print("\nBusinessDay Offset...\n",bdOffset)
# Display the Updated Timestamp
print("\nUpdated Timestamp...\n",timestamp + bdOffset)
# return the frequency applied on the given BusinessDay object as a string
print("\nFrequency on the given BusinessDay Offset...\n",bdOffset.freqstr)
# Display the keyword arguments
print("\nKeyword arguments on the given BusinessDay Offset...\n",bdOffset.kwds) আউটপুট
এটি নিম্নলিখিত কোড তৈরি করবে -
Timestamp...
2021-10-30 01:55:02.000045
BusinessDay Offset...
<BusinessDay: offset=datetime.timedelta(seconds=25620)>
Updated Timestamp...
2021-11-01 09:02:02.000045
Frequency on the given BusinessDay Offset...
B+7H7Min
Keyword arguments on the given BusinessDay Offset...
{'offset': datetime.timedelta(seconds=25620)}