Skip to content

Commit c124e47

Browse files
janelleTomAugspurger
authored andcommitted
DOC: update the pandas.Series.dt.is_year_end docstring (#20274)
1 parent 5c6c5f6 commit c124e47

File tree

1 file changed

+43
-4
lines changed

1 file changed

+43
-4
lines changed

pandas/core/indexes/datetimes.py

Lines changed: 43 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1790,7 +1790,7 @@ def freq(self, value):
17901790
See Also
17911791
--------
17921792
quarter : Return the quarter of the date.
1793-
is_quarter_end : Similar method for indicating the start of a quarter.
1793+
is_quarter_end : Similar property for indicating the start of a quarter.
17941794
17951795
Examples
17961796
--------
@@ -1831,7 +1831,7 @@ def freq(self, value):
18311831
See Also
18321832
--------
18331833
quarter : Return the quarter of the date.
1834-
is_quarter_start : Similar method indicating the quarter start.
1834+
is_quarter_start : Similar property indicating the quarter start.
18351835
18361836
Examples
18371837
--------
@@ -1871,7 +1871,7 @@ def freq(self, value):
18711871
18721872
See Also
18731873
--------
1874-
is_year_end : Similar method indicating the last day of the year.
1874+
is_year_end : Similar property indicating the last day of the year.
18751875
18761876
Examples
18771877
--------
@@ -1902,7 +1902,46 @@ def freq(self, value):
19021902
is_year_end = _field_accessor(
19031903
'is_year_end',
19041904
'is_year_end',
1905-
"Logical indicating if last day of year (defined by frequency)")
1905+
"""
1906+
Indicate whether the date is the last day of the year.
1907+
1908+
Returns
1909+
-------
1910+
Series or DatetimeIndex
1911+
The same type as the original data with boolean values. Series will
1912+
have the same name and index. DatetimeIndex will have the same
1913+
name.
1914+
1915+
See Also
1916+
--------
1917+
is_year_start : Similar property indicating the start of the year.
1918+
1919+
Examples
1920+
--------
1921+
This method is available on Series with datetime values under
1922+
the ``.dt`` accessor, and directly on DatetimeIndex.
1923+
1924+
>>> dates = pd.Series(pd.date_range("2017-12-30", periods=3))
1925+
>>> dates
1926+
0 2017-12-30
1927+
1 2017-12-31
1928+
2 2018-01-01
1929+
dtype: datetime64[ns]
1930+
1931+
>>> dates.dt.is_year_end
1932+
0 False
1933+
1 True
1934+
2 False
1935+
dtype: bool
1936+
1937+
>>> idx = pd.date_range("2017-12-30", periods=3)
1938+
>>> idx
1939+
DatetimeIndex(['2017-12-30', '2017-12-31', '2018-01-01'],
1940+
dtype='datetime64[ns]', freq='D')
1941+
1942+
>>> idx.is_year_end
1943+
array([False, True, False])
1944+
""")
19061945
is_leap_year = _field_accessor(
19071946
'is_leap_year',
19081947
'is_leap_year',

0 commit comments

Comments
 (0)