Skip to content

Commit

Permalink
DOC: update the is_month_start/is_month_end docstring (pandas-dev#23051)
Browse files Browse the repository at this point in the history
  • Loading branch information
CalmDownKarm authored and Pingviinituutti committed Feb 28, 2019
1 parent 3709165 commit 0f96cca
Showing 1 changed file with 30 additions and 18 deletions.
48 changes: 30 additions & 18 deletions pandas/core/arrays/datetimes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1046,48 +1046,60 @@ def date(self):
'dim',
"The number of days in the month")
daysinmonth = days_in_month
is_month_start = _field_accessor(
'is_month_start',
'is_month_start',
"Logical indicating if first day of month (defined by frequency)")
is_month_end = _field_accessor(
'is_month_end',
'is_month_end',
"""
Indicator for whether the date is the last day of the month.
_is_month_doc = """
Indicates whether the date is the {first_or_last} day of the month.
Returns
-------
Series or array
For Series, returns a Series with boolean values. For
DatetimeIndex, returns a boolean array.
For Series, returns a Series with boolean values.
For DatetimeIndex, returns a boolean array.
See Also
--------
is_month_start : Indicator for whether the date is the first day
of the month.
is_month_start : Return a boolean indicating whether the date
is the first day of the month.
is_month_end : Return a boolean indicating whether the date
is the last day of the month.
Examples
--------
This method is available on Series with datetime values under
the ``.dt`` accessor, and directly on DatetimeIndex.
>>> dates = pd.Series(pd.date_range("2018-02-27", periods=3))
>>> dates
>>> s = pd.Series(pd.date_range("2018-02-27", periods=3))
>>> s
0 2018-02-27
1 2018-02-28
2 2018-03-01
dtype: datetime64[ns]
>>> dates.dt.is_month_end
>>> s.dt.is_month_start
0 False
1 False
2 True
dtype: bool
>>> s.dt.is_month_end
0 False
1 True
2 False
dtype: bool
>>> idx = pd.date_range("2018-02-27", periods=3)
>>> idx.is_month_start
array([False, False, True])
>>> idx.is_month_end
array([False, True, False], dtype=bool)
""")
array([False, True, False])
"""
is_month_start = _field_accessor(
'is_month_start',
'is_month_start',
_is_month_doc.format(first_or_last='first'))

is_month_end = _field_accessor(
'is_month_end',
'is_month_end',
_is_month_doc.format(first_or_last='last'))

is_quarter_start = _field_accessor(
'is_quarter_start',
'is_quarter_start',
Expand Down

0 comments on commit 0f96cca

Please sign in to comment.