@@ -1089,27 +1089,142 @@ cdef class Tick(SingleConstructorOffset):
1089
1089
1090
1090
1091
1091
cdef class Day(Tick):
1092
+ """
1093
+ Offset ``n`` days.
1094
+
1095
+ Parameters
1096
+ ----------
1097
+ n : int, default 1
1098
+ The number of days represented.
1099
+
1100
+ See Also
1101
+ --------
1102
+ :class:`~pandas.tseries.offsets.DateOffset` : Standard kind of date increment.
1103
+
1104
+ Examples
1105
+ --------
1106
+ You can use the parameter ``n`` to represent a shift of n days.
1107
+ >>> from pandas.tseries.offsets import Day
1108
+ >>> ts = pd.Timestamp(2022, 12, 9, 15)
1109
+ >>> ts.strftime('%a %d %b %Y %H :%M ')
1110
+ 'Fri 09 Dec 2022 15:00'
1111
+
1112
+ >>> (ts + Day()).strftime('%a %d %b %Y %H :%M ')
1113
+ 'Sat 10 Dec 2022 15:00'
1114
+ >>> (ts - Day(4)).strftime('%a %d %b %Y %H :%M ')
1115
+ 'Mon 05 Dec 2022 15:00'
1116
+
1117
+ >>> (ts + Day(-4)).strftime('%a %d %b %Y %H :%M ')
1118
+ 'Mon 05 Dec 2022 15:00'
1119
+ """
1092
1120
_nanos_inc = 24 * 3600 * 1 _000_000_000
1093
1121
_prefix = " D"
1094
1122
_period_dtype_code = PeriodDtypeCode.D
1095
1123
_creso = NPY_DATETIMEUNIT.NPY_FR_D
1096
1124
1097
1125
1098
1126
cdef class Hour(Tick):
1127
+ """
1128
+ Offset ``n`` hours.
1129
+
1130
+ Parameters
1131
+ ----------
1132
+ n : int, default 1
1133
+ The number of hours represented.
1134
+
1135
+ See Also
1136
+ --------
1137
+ :class:`~pandas.tseries.offsets.DateOffset` : Standard kind of date increment.
1138
+
1139
+ Examples
1140
+ --------
1141
+ You can use the parameter ``n`` to represent a shift of n hours.
1142
+
1143
+ >>> from pandas.tseries.offsets import Hour
1144
+ >>> ts = pd.Timestamp(2022, 12, 9, 15)
1145
+ >>> ts.strftime('%a %d %b %Y %H :%M ')
1146
+ 'Fri 09 Dec 2022 15:00'
1147
+
1148
+ >>> (ts + Hour()).strftime('%a %d %b %Y %H :%M ')
1149
+ 'Fri 09 Dec 2022 16:00'
1150
+ >>> (ts - Hour(4)).strftime('%a %d %b %Y %H :%M ')
1151
+ 'Fri 09 Dec 2022 11:00'
1152
+
1153
+ >>> (ts + Hour(-4)).strftime('%a %d %b %Y %H :%M ')
1154
+ 'Fri 09 Dec 2022 11:00'
1155
+ """
1099
1156
_nanos_inc = 3600 * 1 _000_000_000
1100
1157
_prefix = " H"
1101
1158
_period_dtype_code = PeriodDtypeCode.H
1102
1159
_creso = NPY_DATETIMEUNIT.NPY_FR_h
1103
1160
1104
1161
1105
1162
cdef class Minute(Tick):
1163
+ """
1164
+ Offset ``n`` minutes.
1165
+
1166
+ Parameters
1167
+ ----------
1168
+ n : int, default 1
1169
+ The number of minutes represented.
1170
+
1171
+ See Also
1172
+ --------
1173
+ :class:`~pandas.tseries.offsets.DateOffset` : Standard kind of date increment.
1174
+
1175
+ Examples
1176
+ --------
1177
+ You can use the parameter ``n`` to represent a shift of n minutes.
1178
+
1179
+ >>> from pandas.tseries.offsets import Minute
1180
+ >>> ts = pd.Timestamp(2022, 12, 9, 15)
1181
+ >>> ts.strftime('%a %d %b %Y %H :%M :%S ')
1182
+ 'Fri 09 Dec 2022 15:00:00'
1183
+
1184
+ >>> (ts + Minute(n=10)).strftime('%a %d %b %Y %H :%M :%S ')
1185
+ 'Fri 09 Dec 2022 15:10:00'
1186
+ >>> (ts - Minute(n=10)).strftime('%a %d %b %Y %H :%M :%S ')
1187
+ 'Fri 09 Dec 2022 14:50:00'
1188
+
1189
+ >>> (ts + Minute(n=-10)).strftime('%a %d %b %Y %H :%M :%S ')
1190
+ 'Fri 09 Dec 2022 14:50:00'
1191
+ """
1106
1192
_nanos_inc = 60 * 1 _000_000_000
1107
1193
_prefix = " T"
1108
1194
_period_dtype_code = PeriodDtypeCode.T
1109
1195
_creso = NPY_DATETIMEUNIT.NPY_FR_m
1110
1196
1111
1197
1112
1198
cdef class Second(Tick):
1199
+ """
1200
+ Offset ``n`` seconds.
1201
+
1202
+ Parameters
1203
+ ----------
1204
+ n : int, default 1
1205
+ The number of seconds represented.
1206
+
1207
+ See Also
1208
+ --------
1209
+ :class:`~pandas.tseries.offsets.DateOffset` : Standard kind of date increment.
1210
+
1211
+ Examples
1212
+ --------
1213
+ You can use the parameter ``n`` to represent a shift of n seconds.
1214
+
1215
+ >>> from pandas.tseries.offsets import Second
1216
+ >>> ts = pd.Timestamp(2022, 12, 9, 15)
1217
+ >>> ts.strftime('%a %d %b %Y %H :%M :%S ')
1218
+ 'Fri 09 Dec 2022 15:00:00'
1219
+
1220
+ >>> (ts + Second(n=10)).strftime('%a %d %b %Y %H :%M :%S ')
1221
+ 'Fri 09 Dec 2022 15:00:10'
1222
+ >>> (ts - Second(n=10)).strftime('%a %d %b %Y %H :%M :%S ')
1223
+ 'Fri 09 Dec 2022 14:59:50'
1224
+
1225
+ >>> (ts + Second(n=-10)).strftime('%a %d %b %Y %H :%M :%S ')
1226
+ 'Fri 09 Dec 2022 14:59:50'
1227
+ """
1113
1228
_nanos_inc = 1 _000_000_000
1114
1229
_prefix = " S"
1115
1230
_period_dtype_code = PeriodDtypeCode.S
0 commit comments