From e464f2801db2416a533fe45c1b9ef7221408642c Mon Sep 17 00:00:00 2001 From: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com> Date: Thu, 30 Mar 2023 14:12:02 -0700 Subject: [PATCH 1/2] DOC: Clarify Timestamp(unit=) will not necessarily set unit --- pandas/_libs/tslibs/timestamps.pyx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pandas/_libs/tslibs/timestamps.pyx b/pandas/_libs/tslibs/timestamps.pyx index 10a331f302cc4..acb5ca97be13f 100644 --- a/pandas/_libs/tslibs/timestamps.pyx +++ b/pandas/_libs/tslibs/timestamps.pyx @@ -1293,6 +1293,9 @@ class Timestamp(_Timestamp): Unit used for conversion if ts_input is of type int or float. The valid values are 'D', 'h', 'm', 's', 'ms', 'us', and 'ns'. For example, 's' means seconds and 'ms' means milliseconds. + + The result will be stored in nanoseconds, and the unit attribute + will be set as ``'ns'``. fold : {0, 1}, default None, keyword-only Due to daylight saving time, one wall clock time can occur twice when shifting from summer to winter time; fold describes whether the From 17b44ef87bba1500c5b4abd38c95b4d1c7ee0925 Mon Sep 17 00:00:00 2001 From: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com> Date: Thu, 30 Mar 2023 16:50:53 -0700 Subject: [PATCH 2/2] Clarify for floats --- pandas/_libs/tslibs/timestamps.pyx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandas/_libs/tslibs/timestamps.pyx b/pandas/_libs/tslibs/timestamps.pyx index acb5ca97be13f..e6d1571550b86 100644 --- a/pandas/_libs/tslibs/timestamps.pyx +++ b/pandas/_libs/tslibs/timestamps.pyx @@ -1294,8 +1294,8 @@ class Timestamp(_Timestamp): valid values are 'D', 'h', 'm', 's', 'ms', 'us', and 'ns'. For example, 's' means seconds and 'ms' means milliseconds. - The result will be stored in nanoseconds, and the unit attribute - will be set as ``'ns'``. + For float inputs, the result will be stored in nanoseconds, and + the unit attribute will be set as ``'ns'``. fold : {0, 1}, default None, keyword-only Due to daylight saving time, one wall clock time can occur twice when shifting from summer to winter time; fold describes whether the