Open In App

Pandas Series dt.normalize() | Normalize Time in Pandas Series

Last Updated : 11 Jul, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

When working with DateTime data in Pandas, sometimes the time doesn't matter and you just want to focus on the date. The dt.normalize() method in Pandas is used for this as it resets the time component of each DateTime entry to midnight (00:00:00) while leaving the date and time zone unchanged.

For example, in some cases where data represents events that occur throughout the day but you're only interested in date only like event tracking, daily sales records, etc normalizing the time portion to midnight simplifies comparisons and operations.

1. Importing Libraries and Creating DateTime Series

  • We import the pandas library and create a DateTime series sr using pd.date_range().
  • Range starts from '2025-04-08 12:30' and generates 5 DateTime entries with a frequency of 1 hour (freq='H').
  • Time zone is set to 'Asia/Kolkata'.
Python
import pandas as pd
sr = pd.Series(pd.date_range('2025-04-08 12:30', periods=5, freq='H', tz='Asia/Kolkata'))

2. Apply dt.normalize() to Reset Time to Midnight

  • We use dt.normalize() to reset the time component of each entry to midnight (00:00:00) while keeping the date and time zone unchanged.
  • It has no parameters and returns a DatetimeArray.
Python
result = sr.dt.normalize()
print(result)

Output:

Screenshot-2025-04-11-135313
Normalized Time

By using the dt.normalize() method you can standardize the time in DateTime series allowing easier date-based analysis and comparisons without the influence of the time component.

You can also read:


Explore