@@ -1046,48 +1046,60 @@ def date(self):
1046
1046
'dim' ,
1047
1047
"The number of days in the month" )
1048
1048
daysinmonth = days_in_month
1049
- is_month_start = _field_accessor (
1050
- 'is_month_start' ,
1051
- 'is_month_start' ,
1052
- "Logical indicating if first day of month (defined by frequency)" )
1053
- is_month_end = _field_accessor (
1054
- 'is_month_end' ,
1055
- 'is_month_end' ,
1056
- """
1057
- Indicator for whether the date is the last day of the month.
1049
+ _is_month_doc = """
1050
+ Indicates whether the date is the {first_or_last} day of the month.
1058
1051
1059
1052
Returns
1060
1053
-------
1061
1054
Series or array
1062
- For Series, returns a Series with boolean values. For
1063
- DatetimeIndex, returns a boolean array.
1055
+ For Series, returns a Series with boolean values.
1056
+ For DatetimeIndex, returns a boolean array.
1064
1057
1065
1058
See Also
1066
1059
--------
1067
- is_month_start : Indicator for whether the date is the first day
1068
- of the month.
1060
+ is_month_start : Return a boolean indicating whether the date
1061
+ is the first day of the month.
1062
+ is_month_end : Return a boolean indicating whether the date
1063
+ is the last day of the month.
1069
1064
1070
1065
Examples
1071
1066
--------
1072
1067
This method is available on Series with datetime values under
1073
1068
the ``.dt`` accessor, and directly on DatetimeIndex.
1074
1069
1075
- >>> dates = pd.Series(pd.date_range("2018-02-27", periods=3))
1076
- >>> dates
1070
+ >>> s = pd.Series(pd.date_range("2018-02-27", periods=3))
1071
+ >>> s
1077
1072
0 2018-02-27
1078
1073
1 2018-02-28
1079
1074
2 2018-03-01
1080
1075
dtype: datetime64[ns]
1081
- >>> dates.dt.is_month_end
1076
+ >>> s.dt.is_month_start
1077
+ 0 False
1078
+ 1 False
1079
+ 2 True
1080
+ dtype: bool
1081
+ >>> s.dt.is_month_end
1082
1082
0 False
1083
1083
1 True
1084
1084
2 False
1085
1085
dtype: bool
1086
1086
1087
1087
>>> idx = pd.date_range("2018-02-27", periods=3)
1088
+ >>> idx.is_month_start
1089
+ array([False, False, True])
1088
1090
>>> idx.is_month_end
1089
- array([False, True, False], dtype=bool)
1090
- """ )
1091
+ array([False, True, False])
1092
+ """
1093
+ is_month_start = _field_accessor (
1094
+ 'is_month_start' ,
1095
+ 'is_month_start' ,
1096
+ _is_month_doc .format (first_or_last = 'first' ))
1097
+
1098
+ is_month_end = _field_accessor (
1099
+ 'is_month_end' ,
1100
+ 'is_month_end' ,
1101
+ _is_month_doc .format (first_or_last = 'last' ))
1102
+
1091
1103
is_quarter_start = _field_accessor (
1092
1104
'is_quarter_start' ,
1093
1105
'is_quarter_start' ,
0 commit comments