From 3ac5d013c4d954f02d66bdb51660187ff21aece0 Mon Sep 17 00:00:00 2001 From: Kevin Sheppard Date: Sun, 16 Oct 2022 21:56:09 +0100 Subject: [PATCH] DOC: Add missing parameter to Timedelta.view --- pandas/_libs/tslibs/timedeltas.pyi | 1 + pandas/_libs/tslibs/timedeltas.pyx | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/pandas/_libs/tslibs/timedeltas.pyi b/pandas/_libs/tslibs/timedeltas.pyi index b40b08eb601a4..d514a295215cb 100644 --- a/pandas/_libs/tslibs/timedeltas.pyi +++ b/pandas/_libs/tslibs/timedeltas.pyi @@ -150,6 +150,7 @@ class Timedelta(timedelta): def __hash__(self) -> int: ... def isoformat(self) -> str: ... def to_numpy(self) -> np.timedelta64: ... + def view(self, dtype: npt.DTypeLike = ...) -> object: ... @property def freq(self) -> None: ... @property diff --git a/pandas/_libs/tslibs/timedeltas.pyx b/pandas/_libs/tslibs/timedeltas.pyx index 3aaf321f301cb..32c8f535a845d 100644 --- a/pandas/_libs/tslibs/timedeltas.pyx +++ b/pandas/_libs/tslibs/timedeltas.pyx @@ -1240,6 +1240,11 @@ cdef class _Timedelta(timedelta): def view(self, dtype): """ Array view compatibility. + + Parameters + ---------- + dtype : str or dtype + The dtype to view the underlying data as. """ return np.timedelta64(self.value).view(dtype)