pandas.Series.dt.is_quarter_end#
- Series.dt.is_quarter_end[source] #
Indicator for whether the date is the last day of a quarter.
- Returns:
- is_quarter_endSeries or DatetimeIndex
The same type as the original data with boolean values. Series will have the same name and index. DatetimeIndex will have the same name.
See also
quarter
Return the quarter of the date.
is_quarter_start
Similar property indicating the quarter start.
Examples
This method is available on Series with datetime values under the
.dt
accessor, and directly on DatetimeIndex.>>> df = pd.DataFrame({'dates': pd.date_range("2017年03月30日", ... periods=4)}) >>> df.assign(quarter=df.dates.dt.quarter, ... is_quarter_end=df.dates.dt.is_quarter_end) dates quarter is_quarter_end 0 2017年03月30日 1 False 1 2017年03月31日 1 True 2 2017年04月01日 2 False 3 2017年04月02日 2 False
>>> idx = pd.date_range('2017年03月30日', periods=4) >>> idx DatetimeIndex(['2017年03月30日', '2017年03月31日', '2017年04月01日', '2017年04月02日'], dtype='datetime64[ns]', freq='D')
>>> idx.is_quarter_end array([False, True, False, False])