@@ -154,40 +154,40 @@ class _DatetimeLikeOps(
154
154
# type of the series, we don't know which kind of series was ...ed
155
155
# in to the dt accessor
156
156
157
- _DTRoundingMethodReturnType = TypeVar (
158
- "_DTRoundingMethodReturnType " ,
157
+ _DTTimestampTimedeltaReturnType = TypeVar (
158
+ "_DTTimestampTimedeltaReturnType " ,
159
159
Series ,
160
- TimedeltaSeries ,
161
160
TimestampSeries ,
161
+ TimedeltaSeries ,
162
162
DatetimeIndex ,
163
163
TimedeltaIndex ,
164
164
)
165
165
166
- class _DatetimeRoundingMethods (Generic [_DTRoundingMethodReturnType ]):
166
+ class _DatetimeRoundingMethods (Generic [_DTTimestampTimedeltaReturnType ]):
167
167
def round (
168
168
self ,
169
169
freq : str | BaseOffset | None ,
170
170
ambiguous : Literal ["raise" , "infer" , "NaT" ] | np_ndarray_bool = ...,
171
171
nonexistent : Literal ["shift_forward" , "shift_backward" , "NaT" , "raise" ]
172
172
| timedelta
173
173
| Timedelta = ...,
174
- ) -> _DTRoundingMethodReturnType : ...
174
+ ) -> _DTTimestampTimedeltaReturnType : ...
175
175
def floor (
176
176
self ,
177
177
freq : str | BaseOffset | None ,
178
178
ambiguous : Literal ["raise" , "infer" , "NaT" ] | np_ndarray_bool = ...,
179
179
nonexistent : Literal ["shift_forward" , "shift_backward" , "NaT" , "raise" ]
180
180
| timedelta
181
181
| Timedelta = ...,
182
- ) -> _DTRoundingMethodReturnType : ...
182
+ ) -> _DTTimestampTimedeltaReturnType : ...
183
183
def ceil (
184
184
self ,
185
185
freq : str | BaseOffset | None ,
186
186
ambiguous : Literal ["raise" , "infer" , "NaT" ] | np_ndarray_bool = ...,
187
187
nonexistent : Literal ["shift_forward" , "shift_backward" , "NaT" , "raise" ]
188
188
| timedelta
189
189
| Timedelta = ...,
190
- ) -> _DTRoundingMethodReturnType : ...
190
+ ) -> _DTTimestampTimedeltaReturnType : ...
191
191
192
192
_DTNormalizeReturnType = TypeVar (
193
193
"_DTNormalizeReturnType" , TimestampSeries , DatetimeIndex
@@ -196,9 +196,9 @@ _DTStrKindReturnType = TypeVar("_DTStrKindReturnType", Series[str], Index)
196
196
_DTToPeriodReturnType = TypeVar ("_DTToPeriodReturnType" , PeriodSeries , PeriodIndex )
197
197
198
198
class _DatetimeLikeNoTZMethods (
199
- _DatetimeRoundingMethods [_DTRoundingMethodReturnType ],
199
+ _DatetimeRoundingMethods [_DTTimestampTimedeltaReturnType ],
200
200
Generic [
201
- _DTRoundingMethodReturnType ,
201
+ _DTTimestampTimedeltaReturnType ,
202
202
_DTNormalizeReturnType ,
203
203
_DTStrKindReturnType ,
204
204
_DTToPeriodReturnType ,
@@ -230,15 +230,15 @@ class _DatetimeNoTZProperties(
230
230
_DTFreqReturnType ,
231
231
],
232
232
_DatetimeLikeNoTZMethods [
233
- _DTRoundingMethodReturnType ,
233
+ _DTTimestampTimedeltaReturnType ,
234
234
_DTNormalizeReturnType ,
235
235
_DTStrKindReturnType ,
236
236
_DTToPeriodReturnType ,
237
237
],
238
238
Generic [
239
239
_DTFieldOpsReturnType ,
240
240
_DTBoolOpsReturnType ,
241
- _DTRoundingMethodReturnType ,
241
+ _DTTimestampTimedeltaReturnType ,
242
242
_DTOtherOpsDateReturnType ,
243
243
_DTOtherOpsTimeReturnType ,
244
244
_DTFreqReturnType ,
@@ -253,7 +253,7 @@ class DatetimeProperties(
253
253
_DatetimeNoTZProperties [
254
254
_DTFieldOpsReturnType ,
255
255
_DTBoolOpsReturnType ,
256
- _DTRoundingMethodReturnType ,
256
+ _DTTimestampTimedeltaReturnType ,
257
257
_DTOtherOpsDateReturnType ,
258
258
_DTOtherOpsTimeReturnType ,
259
259
_DTFreqReturnType ,
@@ -264,7 +264,7 @@ class DatetimeProperties(
264
264
Generic [
265
265
_DTFieldOpsReturnType ,
266
266
_DTBoolOpsReturnType ,
267
- _DTRoundingMethodReturnType ,
267
+ _DTTimestampTimedeltaReturnType ,
268
268
_DTOtherOpsDateReturnType ,
269
269
_DTOtherOpsTimeReturnType ,
270
270
_DTFreqReturnType ,
@@ -275,6 +275,11 @@ class DatetimeProperties(
275
275
):
276
276
def to_pydatetime (self ) -> np .ndarray : ...
277
277
def isocalendar (self ) -> DataFrame : ...
278
+ @property
279
+ def unit (self ) -> str : ...
280
+ def as_unit (
281
+ self , unit : Literal ["s" , "ms" , "us" , "ns" ]
282
+ ) -> _DTTimestampTimedeltaReturnType : ...
278
283
279
284
_TDNoRoundingMethodReturnType = TypeVar (
280
285
"_TDNoRoundingMethodReturnType" , Series [int ], Index
@@ -301,7 +306,10 @@ class TimedeltaProperties(
301
306
Properties ,
302
307
_TimedeltaPropertiesNoRounding [Series [int ], Series [float ]],
303
308
_DatetimeRoundingMethods [TimedeltaSeries ],
304
- ): ...
309
+ ):
310
+ @property
311
+ def unit (self ) -> str : ...
312
+ def as_unit (self , unit : Literal ["s" , "ms" , "us" , "ns" ]) -> TimedeltaSeries : ...
305
313
306
314
_PeriodDTReturnTypes = TypeVar ("_PeriodDTReturnTypes" , TimestampSeries , DatetimeIndex )
307
315
_PeriodIntReturnTypes = TypeVar ("_PeriodIntReturnTypes" , Series [int ], Index [int ])
0 commit comments