Skip to content

Commit 52ef641

Browse files
janelleTomAugspurger
authored andcommitted
DOC: update the pandas.Series.dt.is_quarter_end docstring (#20279)
1 parent e3f9633 commit 52ef641

File tree

1 file changed

+38
-1
lines changed

1 file changed

+38
-1
lines changed

pandas/core/indexes/datetimes.py

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1781,7 +1781,44 @@ def freq(self, value):
17811781
is_quarter_end = _field_accessor(
17821782
'is_quarter_end',
17831783
'is_quarter_end',
1784-
"Logical indicating if last day of quarter (defined by frequency)")
1784+
"""
1785+
Indicator for whether the date is the last day of a quarter.
1786+
1787+
Returns
1788+
-------
1789+
is_quarter_end : Series or DatetimeIndex
1790+
The same type as the original data with boolean values. Series will
1791+
have the same name and index. DatetimeIndex will have the same
1792+
name.
1793+
1794+
See Also
1795+
--------
1796+
quarter : Return the quarter of the date.
1797+
is_quarter_start : Similar method indicating the quarter start.
1798+
1799+
Examples
1800+
--------
1801+
This method is available on Series with datetime values under
1802+
the ``.dt`` accessor, and directly on DatetimeIndex.
1803+
1804+
>>> df = pd.DataFrame({'dates': pd.date_range("2017-03-30",
1805+
... periods=4)})
1806+
>>> df.assign(quarter=df.dates.dt.quarter,
1807+
... is_quarter_end=df.dates.dt.is_quarter_end)
1808+
dates quarter is_quarter_end
1809+
0 2017-03-30 1 False
1810+
1 2017-03-31 1 True
1811+
2 2017-04-01 2 False
1812+
3 2017-04-02 2 False
1813+
1814+
>>> idx = pd.date_range('2017-03-30', periods=4)
1815+
>>> idx
1816+
DatetimeIndex(['2017-03-30', '2017-03-31', '2017-04-01', '2017-04-02'],
1817+
dtype='datetime64[ns]', freq='D')
1818+
1819+
>>> idx.is_quarter_end
1820+
array([False, True, False, False])
1821+
""")
17851822
is_year_start = _field_accessor(
17861823
'is_year_start',
17871824
'is_year_start',

0 commit comments

Comments
 (0)