Skip to content

Commit c2b5349

Browse files
authored
[pandas] Fix pandas Timedelta total_seconds return type (#169)
The `total_seconds` method returns a float, rather than an int. This can be tested/confirmed as follows: ```python import pandas as pd ptd = pd.to_timedelta(1234.5678, unit="s") print(ptd.total_seconds()) # 1234.5678 print(type(ptd.total_seconds())) # <class 'float'> print(type(ptd)) # <class 'pandas._libs.tslibs.timedeltas.Timedelta'> ```
1 parent 1d02adf commit c2b5349

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

partial/pandas/_libs/tslibs/timedeltas.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ class Timedelta(_Timedelta):
7777
def to_numpy(self) -> _np.timedelta64: ...
7878
def to_pytimedelta(self) -> datetime.timedelta: ...
7979
def to_timedelta64(self) -> _np.timedelta64: ...
80-
def total_seconds(self) -> int: ...
80+
def total_seconds(self) -> float: ...
8181

8282

8383
def delta_to_nanoseconds(delta: _Timedelta) -> int: ...

0 commit comments

Comments
 (0)