Skip to content

Commit a83501d

Browse files
committed
Add unit property to Timedelta
1 parent 31e8269 commit a83501d

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

pandas-stubs/_libs/tslibs/timedeltas.pyi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,3 +390,5 @@ class Timedelta(timedelta):
390390
@property
391391
def components(self) -> Components: ...
392392
def view(self, dtype: npt.DTypeLike = ...) -> object: ...
393+
@property
394+
def unit(self) -> str: ...

tests/test_scalars.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -517,6 +517,7 @@ def test_timedelta_properties_methods() -> None:
517517
check(assert_type(td.value, int), int)
518518
check(assert_type(td.resolution_string, str), str)
519519
check(assert_type(td.components, Components), Components)
520+
check(assert_type(td.unit, str), str)
520521

521522
check(assert_type(td.ceil("D"), pd.Timedelta), pd.Timedelta)
522523
check(assert_type(td.floor(Day()), pd.Timedelta), pd.Timedelta)

0 commit comments

Comments
 (0)