pandas.Timestamp.quarter#
- Timestamp.quarter#
Return the quarter of the year for the Timestamp.
This property returns an integer representing the quarter of the year in which the Timestamp falls. The quarters are defined as follows: - Q1: January 1 to March 31 - Q2: April 1 to June 30 - Q3: July 1 to September 30 - Q4: October 1 to December 31
- Returns:
- int
The quarter of the year (1 through 4).
See also
Timestamp.month
Returns the month of the Timestamp.
Timestamp.year
Returns the year of the Timestamp.
Examples
Get the quarter for a Timestamp:
>>> ts = pd.Timestamp(2020, 3, 14) >>> ts.quarter 1
For a Timestamp in the fourth quarter:
>>> ts = pd.Timestamp(2020, 10, 14) >>> ts.quarter 4