From 8da317cb8c3ed204206ca890bfb9f968288995e2 Mon Sep 17 00:00:00 2001 From: ZKaoChi <1953542921@qq.com> Date: Wed, 16 Oct 2024 20:20:00 +0800 Subject: [PATCH 1/6] DOC: Solution for issue #60044 --- pandas/_libs/tslibs/timedeltas.pyx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pandas/_libs/tslibs/timedeltas.pyx b/pandas/_libs/tslibs/timedeltas.pyx index bbefea7c47fc3..db43cf967f1bb 100644 --- a/pandas/_libs/tslibs/timedeltas.pyx +++ b/pandas/_libs/tslibs/timedeltas.pyx @@ -1864,10 +1864,11 @@ class Timedelta(_Timedelta): Parameters ---------- - value : Timedelta, timedelta, np.timedelta64, str, or int + value : Timedelta, timedelta, np.timedelta64, str, int or float Input value. unit : str, default 'ns' - Denote the unit of the input, if input is an integer. + If input is an integer, denote the unit of the input. + If input is a float, denote the unit of the integer part and proportionally convert the decimal part.(If unit=None, ignore the decimal part.) Possible values: From 039af7e599f623817027b62633cfb91907c64da9 Mon Sep 17 00:00:00 2001 From: ZKaoChi <1953542921@qq.com> Date: Wed, 16 Oct 2024 22:34:47 +0800 Subject: [PATCH 2/6] reduce characters for each line --- pandas/_libs/tslibs/timedeltas.pyx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pandas/_libs/tslibs/timedeltas.pyx b/pandas/_libs/tslibs/timedeltas.pyx index db43cf967f1bb..f23ce30e0c501 100644 --- a/pandas/_libs/tslibs/timedeltas.pyx +++ b/pandas/_libs/tslibs/timedeltas.pyx @@ -1868,7 +1868,8 @@ class Timedelta(_Timedelta): Input value. unit : str, default 'ns' If input is an integer, denote the unit of the input. - If input is a float, denote the unit of the integer part and proportionally convert the decimal part.(If unit=None, ignore the decimal part.) + If input is a float, denote the unit of integer parts. + (If unit = None, ignore decimal parts. Otherwise proportionally convert them.) Possible values: From 53559a47b271a62cb228154159cb4aaab3c3556b Mon Sep 17 00:00:00 2001 From: ZKaoChi <1953542921@qq.com> Date: Thu, 17 Oct 2024 15:56:38 +0800 Subject: [PATCH 3/6] DOC: Make the value parameter of pandas.Timedelta can accept float --- pandas/_libs/tslibs/timedeltas.pyx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandas/_libs/tslibs/timedeltas.pyx b/pandas/_libs/tslibs/timedeltas.pyx index f23ce30e0c501..bffcc223a7f5a 100644 --- a/pandas/_libs/tslibs/timedeltas.pyx +++ b/pandas/_libs/tslibs/timedeltas.pyx @@ -1868,8 +1868,8 @@ class Timedelta(_Timedelta): Input value. unit : str, default 'ns' If input is an integer, denote the unit of the input. - If input is a float, denote the unit of integer parts. - (If unit = None, ignore decimal parts. Otherwise proportionally convert them.) + If input is a float, denote the unit of the integer parts. + (The decimal parts with an accuracy higher than 1 nanosecond are ignored.) Possible values: From 3fee4ee16920b9547e0781762cc971218cf34983 Mon Sep 17 00:00:00 2001 From: ZKaoChi <1953542921@qq.com> Date: Tue, 29 Oct 2024 10:44:49 +0800 Subject: [PATCH 4/6] Change the expression --- pandas/_libs/tslibs/timedeltas.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/_libs/tslibs/timedeltas.pyx b/pandas/_libs/tslibs/timedeltas.pyx index bffcc223a7f5a..299730df86923 100644 --- a/pandas/_libs/tslibs/timedeltas.pyx +++ b/pandas/_libs/tslibs/timedeltas.pyx @@ -1869,7 +1869,7 @@ class Timedelta(_Timedelta): unit : str, default 'ns' If input is an integer, denote the unit of the input. If input is a float, denote the unit of the integer parts. - (The decimal parts with an accuracy higher than 1 nanosecond are ignored.) + The decimal parts with resolution lower than 1 nanosecond are ignored. Possible values: From 12d871fb6a4a53f9bf903af4f9f128bea9954846 Mon Sep 17 00:00:00 2001 From: ZKaoChi <1953542921@qq.com> Date: Tue, 29 Oct 2024 20:02:49 +0800 Subject: [PATCH 5/6] environment update --- pandas/_libs/tslibs/timedeltas.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/_libs/tslibs/timedeltas.pyx b/pandas/_libs/tslibs/timedeltas.pyx index 299730df86923..7020e061118d9 100644 --- a/pandas/_libs/tslibs/timedeltas.pyx +++ b/pandas/_libs/tslibs/timedeltas.pyx @@ -1869,7 +1869,7 @@ class Timedelta(_Timedelta): unit : str, default 'ns' If input is an integer, denote the unit of the input. If input is a float, denote the unit of the integer parts. - The decimal parts with resolution lower than 1 nanosecond are ignored. + The decimal parts with resolution lower than 1 nanosecond are ignored. Possible values: From 61039db00ae9d58e91b0d2ea46558c94afae78d0 Mon Sep 17 00:00:00 2001 From: ZKaoChi <1953542921@qq.com> Date: Tue, 29 Oct 2024 20:06:14 +0800 Subject: [PATCH 6/6] environment update --- pandas/_libs/tslibs/timedeltas.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/_libs/tslibs/timedeltas.pyx b/pandas/_libs/tslibs/timedeltas.pyx index 7020e061118d9..299730df86923 100644 --- a/pandas/_libs/tslibs/timedeltas.pyx +++ b/pandas/_libs/tslibs/timedeltas.pyx @@ -1869,7 +1869,7 @@ class Timedelta(_Timedelta): unit : str, default 'ns' If input is an integer, denote the unit of the input. If input is a float, denote the unit of the integer parts. - The decimal parts with resolution lower than 1 nanosecond are ignored. + The decimal parts with resolution lower than 1 nanosecond are ignored. Possible values: