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