কম্পিউটার

Python Pandas - বিজনেসডে অফসেটে প্রয়োগ করা বৃদ্ধির গণনা ফেরত দিন


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

  1. Python Pandas - একটি বিজনেস ডে অফসেট তৈরি করুন

  2. Python Pandas - প্রদত্ত তারিখ অফসেট অবজেক্টে প্রয়োগ করা বৃদ্ধির গণনা ফেরত দিন

  3. Python Pandas - অফসেট অবজেক্টে প্রয়োগ করা ফ্রিকোয়েন্সিটির নাম ফেরত দিন

  4. Python Pandas - প্রদত্ত তারিখ অফসেট অবজেক্টে প্রয়োগ করা ফ্রিকোয়েন্সি ফেরত দিন