From ecf08873915e62ba1fb213953703c1daba6b5d8a Mon Sep 17 00:00:00 2001 From: Janelle Date: Sat, 10 Mar 2018 15:52:17 +0100 Subject: [PATCH 1/5] doctring rewritten --- pandas/core/indexes/datetimes.py | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/pandas/core/indexes/datetimes.py b/pandas/core/indexes/datetimes.py index e5e9bba269fd4..4b50c89f37ab2 100644 --- a/pandas/core/indexes/datetimes.py +++ b/pandas/core/indexes/datetimes.py @@ -1731,7 +1731,32 @@ def freq(self, value): is_month_end = _field_accessor( 'is_month_end', 'is_month_end', - "Logical indicating if last day of month (defined by frequency)") + """ + Return a boolean indicating if the date is the last day of the month. + + Returns + ------- + is_month_end : Series of boolean + + See Also + -------- + is_month_start : Returns a boolean indicating if the date is the first day + of the month. + + Examples + -------- + >>> dates = pd.Series(pd.date_range("2018-02-27", periods=3)) + >>> dates + 0 2018-02-27 + 1 2018-02-28 + 2 2018-03-01 + dtype: datetime64[ns] + >>> dates.dt.is_month_start + 0 False + 1 True + 2 False + dtype: bool + """) is_quarter_start = _field_accessor( 'is_quarter_start', 'is_quarter_start', From 60f7c228b94b03d08ca92726a6b8d8c7359d575f Mon Sep 17 00:00:00 2001 From: Janelle Date: Sat, 10 Mar 2018 16:24:49 +0100 Subject: [PATCH 2/5] docstring adjusted --- pandas/core/indexes/datetimes.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pandas/core/indexes/datetimes.py b/pandas/core/indexes/datetimes.py index 4b50c89f37ab2..287cc920d295f 100644 --- a/pandas/core/indexes/datetimes.py +++ b/pandas/core/indexes/datetimes.py @@ -1732,16 +1732,16 @@ def freq(self, value): 'is_month_end', 'is_month_end', """ - Return a boolean indicating if the date is the last day of the month. + Return a boolean indicating whether the date is the last day of the month. Returns ------- - is_month_end : Series of boolean + is_month_end : Series of boolean. See Also -------- - is_month_start : Returns a boolean indicating if 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. Examples -------- @@ -1751,7 +1751,7 @@ def freq(self, value): 1 2018-02-28 2 2018-03-01 dtype: datetime64[ns] - >>> dates.dt.is_month_start + >>> dates.dt.is_month_end 0 False 1 True 2 False From 5749f9ea9bf87d5585d6349d861d6d3d1ba8768f Mon Sep 17 00:00:00 2001 From: Janelle Date: Sun, 11 Mar 2018 10:12:30 +0100 Subject: [PATCH 3/5] wrapped words at line length 80 --- pandas/core/indexes/datetimes.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pandas/core/indexes/datetimes.py b/pandas/core/indexes/datetimes.py index 287cc920d295f..40cc63aa9d4f2 100644 --- a/pandas/core/indexes/datetimes.py +++ b/pandas/core/indexes/datetimes.py @@ -1740,8 +1740,7 @@ def freq(self, value): See Also -------- - is_month_start : Return a boolean indicating 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. Examples -------- From fa9c2f09d221d4cd7322a7fd3a5b3e17bd307766 Mon Sep 17 00:00:00 2001 From: Joris Van den Bossche Date: Sat, 17 Mar 2018 12:56:13 +0100 Subject: [PATCH 4/5] pep8 + add index example --- pandas/core/indexes/datetimes.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/pandas/core/indexes/datetimes.py b/pandas/core/indexes/datetimes.py index 84199d8c520b7..2f25a5c91a79e 100644 --- a/pandas/core/indexes/datetimes.py +++ b/pandas/core/indexes/datetimes.py @@ -1774,18 +1774,24 @@ def freq(self, value): 'is_month_end', 'is_month_end', """ - Return a boolean indicating whether the date is the last day of the month. + Indicator for whether the date is the last day of the month. Returns ------- - is_month_end : Series of boolean. + Series or array + For Series, returns a Series with boolean values. For + DatetimeIndex, returns a boolean array. See Also -------- - is_month_start : Return a boolean indicating whether the date is the first day of the month. + is_month_start : Indicator for whether the date is the first 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 0 2018-02-27 @@ -1797,6 +1803,9 @@ def freq(self, value): 1 True 2 False dtype: bool + + >>> idx = pd.date_range("2018-02-27", periods=3) + array([False, True, False], dtype=bool) """) is_quarter_start = _field_accessor( 'is_quarter_start', From 2b540e032f209a3b01ddfff3ca3331d3ae244850 Mon Sep 17 00:00:00 2001 From: Joris Van den Bossche Date: Sat, 17 Mar 2018 12:58:05 +0100 Subject: [PATCH 5/5] fix exampel --- pandas/core/indexes/datetimes.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pandas/core/indexes/datetimes.py b/pandas/core/indexes/datetimes.py index 2f25a5c91a79e..e8bc9a2519333 100644 --- a/pandas/core/indexes/datetimes.py +++ b/pandas/core/indexes/datetimes.py @@ -1805,6 +1805,7 @@ def freq(self, value): dtype: bool >>> idx = pd.date_range("2018-02-27", periods=3) + >>> idx.is_month_end array([False, True, False], dtype=bool) """) is_quarter_start = _field_accessor(