

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- 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 - Display the keyword arguments applied on the given BusinessDay object
To display the keyword arguments applied on the given BusinessDay Offset object, use the BusinessDay.kwds 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(offset = datetime.timedelta(hours = 7, minutes = 7))
Display the Updated Timestamp −
print("\nUpdated Timestamp...\n",timestamp + bdOffset)
Display the keyword arguments −
print("\nKeyword arguments on the given BusinessDay Offset...\n",bdOffset.kwds)
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(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)
Output
This will produce the following code −
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)}
- Related Questions & Answers
- Python Pandas - Display the keyword arguments applied on the given BusinessHour object
- Python Pandas - Display the keyword arguments applied on the given CustomBusinessDay object
- Python Pandas - Display the keyword arguments applied on the given CustomBusinessHour object
- Python Pandas - Return the rule code applied on the given BusinessDay object
- 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 BusinessDay offset
- Python Pandas - Return the frequency applied on the given DateOffset object
- Python Pandas - Return the rule code applied on the given DateOffset object
- Python Pandas - Return the rule code applied on the given BusinessHour object
- Python Pandas - Return the rule code applied on the given CustomBusinessDay object
- Python Pandas - Return the rule code applied on the given CustomBusinessHour object
- Python Pandas - Return the count of increments applied on the given DateOffset 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
Advertisements