- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Python Pandas - Return the count of increments applied on the BusinessDay offset
To return the count of increments applied on the BusinessDay offset, use the BusinessDay.n property in Pandas.
At first, import the required libraries −
import datetime import pandas as pd
Set the timestamp object in Pandas” −
timestamp = pd.Timestamp('2021-10-30 01:55:02.000045')
Create the BusinessDay Offset. BusinessDay is the DateOffset subclass −
bdOffset = pd.tseries.offsets.BusinessDay(n = 6)
Display the Updated Timestamp −
print("\nUpdated Timestamp...\n",timestamp + bdOffset)
Return the count of increments on the given BusinessDay object −
print("\nThe count of increments on the BusinessDay object..\n", bdOffset.n)
Example
Following is the code −
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)
Output
This will produce the following code −
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
- Related Articles
- Python Pandas - Return the count of increments applied on the BusinessHour offset
- Python Pandas - Return the count of increments applied on the CustomBusinessDay offset
- Python Pandas - Return the count of increments applied on the CustomBusinessHour offset
- Python Pandas - Return the name of the frequency applied on the given BusinessDay offset object
- Python Pandas - Return frequency applied on the given BusinessDay Offset object as a string
- Python Pandas - Return the count of increments applied on the given DateOffset object
- Python Pandas - Return the rule code applied on the given BusinessDay object
- Python Pandas - Return the name of the frequency that is applied on the offset object
- Python Pandas - Return the name of the frequency applied on the given BusinessHour offset object
- Python Pandas - Return the name of the frequency applied on the given CustomBusinessDay offset object
- Python Pandas - Return the name of the frequency applied on the given CustomBusinessHour offset object
- Python Pandas - Create a BusinessDay offset
- Python Pandas - Display the keyword arguments applied on the given BusinessDay object
- Python Pandas - Return frequency applied on the given BusinessHour Offset object as a string
- Python Pandas - Return frequency applied on the given CustomBusinessDay Offset object as a string

Advertisements