Skip to content

Commit 5c6c5f6

Browse files
janelleTomAugspurger
authored andcommitted
DOC: update the pandas.Series.dt.is_year_start docstring (#20275)
1 parent c1cce51 commit 5c6c5f6

File tree

1 file changed

+40
-1
lines changed

1 file changed

+40
-1
lines changed

pandas/core/indexes/datetimes.py

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1859,7 +1859,46 @@ def freq(self, value):
18591859
is_year_start = _field_accessor(
18601860
'is_year_start',
18611861
'is_year_start',
1862-
"Logical indicating if first day of year (defined by frequency)")
1862+
"""
1863+
Indicate whether the date is the first day of a year.
1864+
1865+
Returns
1866+
-------
1867+
Series or DatetimeIndex
1868+
The same type as the original data with boolean values. Series will
1869+
have the same name and index. DatetimeIndex will have the same
1870+
name.
1871+
1872+
See Also
1873+
--------
1874+
is_year_end : Similar method indicating the last day of the year.
1875+
1876+
Examples
1877+
--------
1878+
This method is available on Series with datetime values under
1879+
the ``.dt`` accessor, and directly on DatetimeIndex.
1880+
1881+
>>> dates = pd.Series(pd.date_range("2017-12-30", periods=3))
1882+
>>> dates
1883+
0 2017-12-30
1884+
1 2017-12-31
1885+
2 2018-01-01
1886+
dtype: datetime64[ns]
1887+
1888+
>>> dates.dt.is_year_start
1889+
0 False
1890+
1 False
1891+
2 True
1892+
dtype: bool
1893+
1894+
>>> idx = pd.date_range("2017-12-30", periods=3)
1895+
>>> idx
1896+
DatetimeIndex(['2017-12-30', '2017-12-31', '2018-01-01'],
1897+
dtype='datetime64[ns]', freq='D')
1898+
1899+
>>> idx.is_year_start
1900+
array([False, False, True])
1901+
""")
18631902
is_year_end = _field_accessor(
18641903
'is_year_end',
18651904
'is_year_end',

0 commit comments

Comments
 (0)