Skip to main content
`Ctrl`+`K`

# pandas.Series.dt.quarter

Series.dt.quarter

  The quarter of the date.

  This attribute returns the quarter of the year for each datetime value in the Series/Index. Quarter 1 includes January through March, quarter 2 includes April through June, quarter 3 includes July through September, and quarter 4 includes October through December.

  See also

  `DatetimeIndex.snap`

    Snap time stamps to nearest occurring frequency.

  `DatetimeIndex.time`

    Returns numpy array of datetime.time objects. The time part of the Timestamps.

  Examples

  For Series:

      >>> s = pd.Series(["1/1/2020 10:00:00+00:00", "4/1/2020 11:00:00+00:00"])
      >>> s = pd.to_datetime(s)
      >>> s
      0   2020-01-01 10:00:00+00:00
      1   2020-04-01 11:00:00+00:00
      dtype: datetime64[us, UTC]
      >>> s.dt.quarter
      0    1
      1    2
      dtype: int32

  For DatetimeIndex:

      >>> idx = pd.DatetimeIndex(["1/1/2020 10:00:00+00:00",
      ...                         "2/1/2020 11:00:00+00:00"])
      >>> idx.quarter
      Index([1, 1], dtype='int32')