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)}