BusinessDay অফসেটে প্রযোজ্য বৃদ্ধির গণনা ফেরত দিতে, পান্ডাসে BusinessDay.n প্রপার্টি ব্যবহার করুন।
প্রথমে, প্রয়োজনীয় লাইব্রেরিগুলি আমদানি করুন -
import datetime import pandas as pd
পান্ডাসে টাইমস্ট্যাম্প অবজেক্ট সেট করুন” -
timestamp = pd.Timestamp('2021-10-30 01:55:02.000045')
বিজনেস ডে অফসেট তৈরি করুন। ব্যবসা দিবস হল তারিখ অফসেট সাবক্লাস −
bdOffset = pd.tseries.offsets.BusinessDay(n = 6)
আপডেট করা টাইমস্ট্যাম্প −
প্রদর্শন করুনprint("\nUpdated Timestamp...\n",timestamp + bdOffset)
প্রদত্ত BusinessDay অবজেক্ট -
-এ বৃদ্ধির গণনা ফেরত দিনprint("\nThe count of increments on the BusinessDay object..\n", bdOffset.n) উদাহরণ
নিম্নলিখিত কোড -
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(n = 6)
# 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)
# return the count of increments on the given BusinessDay object
print("\nThe count of increments on the BusinessDay object..\n", bdOffset.n) আউটপুট
এটি নিম্নলিখিত কোড তৈরি করবে -
Timestamp... 2021-10-30 01:55:02.000045 BusinessDay Offset... <6 * BusinessDays> Updated Timestamp... 2021-11-08 01:55:02.000045 Frequency on the given BusinessDay Offset... 6B The count of increments on the BusinessDay object.. 6