- 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 - Check whether the DateOffset value has been normalized or not
To check whether the DateOff set value has been normalized or not, use the offset.normalize property in Pandas.
At first, import the required libraries −
from pandas.tseries.offsets import DateOffset import pandas as pd
Set the timestamp object in Pandas −
timestamp = pd.Timestamp('2021-09-26 03:25:02.000045')
Create the DateOffset. Incrementing the months here using the "months" parameter. We have normalized the DateOffset using the "normalize" parameter −
offset = pd.tseries.offsets.DateOffset(months=4, normalize=True)
Display the Updated Timestamp −
print("\nUpdated Timestamp...\n",timestamp + offset)
Check whether the DateOffset is normalized or not −
print("\nThe DateOffset is normalized..\n", offset.normalize)
Example
Following is the code −
from pandas.tseries.offsets import DateOffset import pandas as pd # Set the timestamp object in Pandas timestamp = pd.Timestamp('2021-09-26 03:25:02.000045') # Display the Timestamp print("Timestamp...\n",timestamp) # Create the DateOffset # Incrementing the months here using the "months" parameter # We have normalized the DateOffset using the "normalize" parameter offset = pd.tseries.offsets.DateOffset(months=4, normalize=True) # Display the DateOffset print("\nDateOffset...\n",offset) # Display the Updated Timestamp print("\nUpdated Timestamp...\n",timestamp + offset) # check whether the DateOffset is normalized or not print("\nThe DateOffset is normalized..\n", offset.normalize)
Output
This will produce the following code −
Timestamp... 2021-09-26 03:25:02.000045 DateOffset... <DateOffset: months=4> Updated Timestamp... 2022-01-26 00:00:00 The DateOffset is normalized.. True
- Related Articles
- Python Pandas - Check whether the BusinessDay Offset has been normalized or not
- Python Pandas - Check whether the BusinessHour Offset has been normalized or not
- Python Pandas - Check whether the CustomBusinessDay Offset has been normalized or not
- Python Pandas - Check whether the CustomBusinessHour Offset has been normalized or not
- Python Pandas - Check if the given DateOffset is Anchored
- Check whether the Dictionary has the specified key or not in C#
- Check whether a number has consecutive 0’s in the given base or not using Python
- Check whether the entered value is whitespace or not in Java
- Program to check whether every one has at least a friend or not in Python
- How to check whether the Pandas series is having Nan values or not?
- Program to check whether one value is present in BST or not in Python
- Check whether the entered value is a digit or not in Java
- Check whether the entered value is a letter or not in Java
- Check whether the Dictionary contains a specific value or not in C#
- Python Pandas - Check if the dataframe objects are equal or not

Advertisements