Skip to content

Commit c1cce51

Browse files
janelleTomAugspurger
authored andcommitted
DOC: update the pandas.Series.dt.is_quarter_start docstring (#20278)
1 parent 52ef641 commit c1cce51

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
@@ -1777,7 +1777,44 @@ def freq(self, value):
17771777
is_quarter_start = _field_accessor(
17781778
'is_quarter_start',
17791779
'is_quarter_start',
1780-
"Logical indicating if first day of quarter (defined by frequency)")
1780+
"""
1781+
Indicator for whether the date is the first day of a quarter.
1782+
1783+
Returns
1784+
-------
1785+
is_quarter_start : Series or DatetimeIndex
1786+
The same type as the original data with boolean values. Series will
1787+
have the same name and index. DatetimeIndex will have the same
1788+
name.
1789+
1790+
See Also
1791+
--------
1792+
quarter : Return the quarter of the date.
1793+
is_quarter_end : Similar method for indicating the start of a quarter.
1794+
1795+
Examples
1796+
--------
1797+
This method is available on Series with datetime values under
1798+
the ``.dt`` accessor, and directly on DatetimeIndex.
1799+
1800+
>>> df = pd.DataFrame({'dates': pd.date_range("2017-03-30",
1801+
... periods=4)})
1802+
>>> df.assign(quarter=df.dates.dt.quarter,
1803+
... is_quarter_start=df.dates.dt.is_quarter_start)
1804+
dates quarter is_quarter_start
1805+
0 2017-03-30 1 False
1806+
1 2017-03-31 1 False
1807+
2 2017-04-01 2 True
1808+
3 2017-04-02 2 False
1809+
1810+
>>> idx = pd.date_range('2017-03-30', periods=4)
1811+
>>> idx
1812+
DatetimeIndex(['2017-03-30', '2017-03-31', '2017-04-01', '2017-04-02'],
1813+
dtype='datetime64[ns]', freq='D')
1814+
1815+
>>> idx.is_quarter_start
1816+
array([False, False, True, False])
1817+
""")
17811818
is_quarter_end = _field_accessor(
17821819
'is_quarter_end',
17831820
'is_quarter_end',

0 commit comments

Comments
 (0)