Python Pandas: How to Get Quarter from Date (e.g., 2025Q1, 1)
Extracting the calendar quarter (Q1, Q2, Q3, Q4) from a date is a common requirement in time series analysis, financial reporting, and business intelligence using Pandas. Whether your dates are strings or already datetime objects, Pandas provides several convenient ways to determine the quarter.
This guide explains how to get the quarter from a date column in a Pandas DataFrame using Series.dt.quarter, Series.dt.to_period('Q'), and pd.PeriodIndex.