Time Series in Pandas
DatetimeIndex, resample(), rolling(), shift(), date range generation and resampling.
Time in pandas
pandas has first-class datetime support. Converting strings to timestamps and indexing by time unlocks resampling, rolling windows, and lag features.
Parsing with to_datetime
pd.to_datetime converts strings or numbers into proper Timestamp objects, inferring most common formats automatically.
import pandas as pd
d = pd.to_datetime(["2026-01-01", "2026-01-05", "2026-02-10"])
print(d)
print(d.dtype) # datetime64[ns]All lessons in this course
- GroupBy and Aggregation
- Pivot Tables and Cross-Tabulation
- Advanced Merging and Joining
- Time Series in Pandas