From 616698658a31bca2bb8be4bf66d825137ff0c11e Mon Sep 17 00:00:00 2001 From: prabha Date: Fri, 25 Jun 2021 19:58:23 -0400 Subject: [PATCH 1/5] Updated the return type section of to_datetime to include list-like mixed timezone inputs --- pandas/core/tools/datetimes.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pandas/core/tools/datetimes.py b/pandas/core/tools/datetimes.py index 014a702618bda..f8a75b67f9977 100644 --- a/pandas/core/tools/datetimes.py +++ b/pandas/core/tools/datetimes.py @@ -765,6 +765,7 @@ def to_datetime( - list-like: DatetimeIndex - Series: Series of datetime64 dtype - scalar: Timestamp + - list-like with mixed timezones: Index of object In case when it is not possible to return designated types (e.g. when any element of input is before Timestamp.min or after Timestamp.max) From cb4dbd18d8de71e3475179d8da19b8294cbcfa5c Mon Sep 17 00:00:00 2001 From: prabha Date: Sat, 26 Jun 2021 08:01:10 -0400 Subject: [PATCH 2/5] updated the Returns section --- pandas/core/tools/datetimes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/core/tools/datetimes.py b/pandas/core/tools/datetimes.py index f8a75b67f9977..0d8bfbaa5bf83 100644 --- a/pandas/core/tools/datetimes.py +++ b/pandas/core/tools/datetimes.py @@ -765,7 +765,7 @@ def to_datetime( - list-like: DatetimeIndex - Series: Series of datetime64 dtype - scalar: Timestamp - - list-like with mixed timezones: Index of object + - list-like with mixed timezones: Index of object dtype In case when it is not possible to return designated types (e.g. when any element of input is before Timestamp.min or after Timestamp.max) From dfa298a576179b6370115eac1622a4a81f1f122e Mon Sep 17 00:00:00 2001 From: prabha Date: Sat, 26 Jun 2021 22:05:52 -0400 Subject: [PATCH 3/5] updated the Return section as suggested by mroeschke --- pandas/core/tools/datetimes.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pandas/core/tools/datetimes.py b/pandas/core/tools/datetimes.py index 0d8bfbaa5bf83..eab6402b06ad6 100644 --- a/pandas/core/tools/datetimes.py +++ b/pandas/core/tools/datetimes.py @@ -762,10 +762,12 @@ def to_datetime( If parsing succeeded. Return type depends on input: - - list-like: DatetimeIndex + - list-like: + - DatetimeIndex, if timezone naive or aware with the same timezone + - Index of object dtype, if timezone aware with mixed timezones - Series: Series of datetime64 dtype - scalar: Timestamp - - list-like with mixed timezones: Index of object dtype + In case when it is not possible to return designated types (e.g. when any element of input is before Timestamp.min or after Timestamp.max) From d84f2c7d493ee04dc8a1261a81a05102d63e62c3 Mon Sep 17 00:00:00 2001 From: prabha Date: Sun, 27 Jun 2021 00:14:54 -0400 Subject: [PATCH 4/5] removed the extra line in my previous commit --- pandas/core/tools/datetimes.py | 1 - 1 file changed, 1 deletion(-) diff --git a/pandas/core/tools/datetimes.py b/pandas/core/tools/datetimes.py index eab6402b06ad6..dc966efe1626c 100644 --- a/pandas/core/tools/datetimes.py +++ b/pandas/core/tools/datetimes.py @@ -768,7 +768,6 @@ def to_datetime( - Series: Series of datetime64 dtype - scalar: Timestamp - In case when it is not possible to return designated types (e.g. when any element of input is before Timestamp.min or after Timestamp.max) return will have datetime.datetime type (or corresponding From 6efbb73c225586c3f3e4a80bd7ba29cb4810cc7b Mon Sep 17 00:00:00 2001 From: Prabha Arivalagan Date: Wed, 30 Jun 2021 15:50:06 -0400 Subject: [PATCH 5/5] Update pandas/core/tools/datetimes.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Sylvain MariƩ --- pandas/core/tools/datetimes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/core/tools/datetimes.py b/pandas/core/tools/datetimes.py index dc966efe1626c..9a1ee029f1609 100644 --- a/pandas/core/tools/datetimes.py +++ b/pandas/core/tools/datetimes.py @@ -764,7 +764,7 @@ def to_datetime( - list-like: - DatetimeIndex, if timezone naive or aware with the same timezone - - Index of object dtype, if timezone aware with mixed timezones + - Index of object dtype, if timezone aware with mixed time offsets - Series: Series of datetime64 dtype - scalar: Timestamp