From a458ca7d77596ccb3a09f1a3ebdf22612732bc7d Mon Sep 17 00:00:00 2001 From: Sarva Sanjay Date: Thu, 27 Oct 2022 00:08:22 -0400 Subject: [PATCH 1/7] Removed line about %S parses all the way up to nanosecond even if no decimal place present from docstring --- pandas/core/tools/datetimes.py | 7 ------- 1 file changed, 7 deletions(-) diff --git a/pandas/core/tools/datetimes.py b/pandas/core/tools/datetimes.py index 7791ea804a52a..d6e332748a8c5 100644 --- a/pandas/core/tools/datetimes.py +++ b/pandas/core/tools/datetimes.py @@ -787,10 +787,6 @@ def to_datetime( - :const:`"%f"` will parse all the way up to nanoseconds; - - :const:`"%S"` without :const:`"%f"` will capture all the way - up to nanoseconds if present as decimal places, and will also handle - the case where the number of seconds is an integer. - exact : bool, default True Control how `format` is used: @@ -969,9 +965,6 @@ def to_datetime( ... format='%Y-%m-%d %H:%M:%S.%f') Timestamp('2018-10-26 12:00:00.000000001') - :const:`"%S"` without :const:`"%f"` will capture all the way - up to nanoseconds if present as decimal places. - >>> pd.to_datetime('2017-03-22 15:16:45.433502912', ... format='%Y-%m-%d %H:%M:%S') Timestamp('2017-03-22 15:16:45.433502912') From 61fa5311588fd7d7f02d403bdb7fd42b0a4f36ff Mon Sep 17 00:00:00 2001 From: Sarva Sanjay Date: Thu, 27 Oct 2022 08:54:24 -0400 Subject: [PATCH 2/7] Deleted example code and changed documentation to though note that %f will parse all the way up to nanoseconds --- pandas/core/tools/datetimes.py | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/pandas/core/tools/datetimes.py b/pandas/core/tools/datetimes.py index d6e332748a8c5..8df33780fc58e 100644 --- a/pandas/core/tools/datetimes.py +++ b/pandas/core/tools/datetimes.py @@ -782,10 +782,7 @@ def to_datetime( `strftime documentation `_ for more information on choices, though - note the following differences: - - - :const:`"%f"` will parse all the way - up to nanoseconds; + note that :const:`"%f"` will parse all the way up to nanoseconds. exact : bool, default True Control how `format` is used: @@ -965,10 +962,6 @@ def to_datetime( ... format='%Y-%m-%d %H:%M:%S.%f') Timestamp('2018-10-26 12:00:00.000000001') - >>> pd.to_datetime('2017-03-22 15:16:45.433502912', - ... format='%Y-%m-%d %H:%M:%S') - Timestamp('2017-03-22 15:16:45.433502912') - **Non-convertible date/times** If a date does not meet the `timestamp limitations From 70877e7745a7dc1c6516e3a0de550bd8fa18ff82 Mon Sep 17 00:00:00 2001 From: Sarva Sanjay Date: Thu, 27 Oct 2022 10:32:07 -0400 Subject: [PATCH 3/7] Fixed CI error --- 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 8df33780fc58e..1c6b044467193 100644 --- a/pandas/core/tools/datetimes.py +++ b/pandas/core/tools/datetimes.py @@ -782,7 +782,7 @@ def to_datetime( `strftime documentation `_ for more information on choices, though - note that :const:`"%f"` will parse all the way up to nanoseconds. + note that `"%f"` will parse all the way up to nanoseconds. exact : bool, default True Control how `format` is used: From 81c758dd2fe3221adf5d6478e6374019f91ac478 Mon Sep 17 00:00:00 2001 From: Sarva Sanjay Date: Thu, 27 Oct 2022 11:13:14 -0400 Subject: [PATCH 4/7] Changed to %f --- 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 1c6b044467193..fb3ad2c7ccb7a 100644 --- a/pandas/core/tools/datetimes.py +++ b/pandas/core/tools/datetimes.py @@ -782,7 +782,7 @@ def to_datetime( `strftime documentation `_ for more information on choices, though - note that `"%f"` will parse all the way up to nanoseconds. + note that "%f" will parse all the way up to nanoseconds. exact : bool, default True Control how `format` is used: From 61cc6796a8ed5a09135de4de7399a3cf66438d11 Mon Sep 17 00:00:00 2001 From: sarvaSanjay <111774640+sarvaSanjay@users.noreply.github.com> Date: Thu, 27 Oct 2022 12:21:23 -0400 Subject: [PATCH 5/7] Removed line between format and exact --- 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 fb3ad2c7ccb7a..bfa51b99b05e1 100644 --- a/pandas/core/tools/datetimes.py +++ b/pandas/core/tools/datetimes.py @@ -783,7 +783,6 @@ def to_datetime( `_ for more information on choices, though note that "%f" will parse all the way up to nanoseconds. - exact : bool, default True Control how `format` is used: From 14d3a841f94b45c07f79de40f31e81b8560adc50 Mon Sep 17 00:00:00 2001 From: sarvaSanjay <111774640+sarvaSanjay@users.noreply.github.com> Date: Thu, 27 Oct 2022 16:08:43 -0400 Subject: [PATCH 6/7] removed whitespace at end of line --- 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 bfa51b99b05e1..53ae51a3823a5 100644 --- a/pandas/core/tools/datetimes.py +++ b/pandas/core/tools/datetimes.py @@ -782,7 +782,7 @@ def to_datetime( `strftime documentation `_ for more information on choices, though - note that "%f" will parse all the way up to nanoseconds. + note that "%f" will parse all the way up to nanoseconds. exact : bool, default True Control how `format` is used: From a7e55dded08c890b94c4e66eff2b28e84100dd85 Mon Sep 17 00:00:00 2001 From: sarvaSanjay <111774640+sarvaSanjay@users.noreply.github.com> Date: Fri, 28 Oct 2022 02:50:21 -0400 Subject: [PATCH 7/7] Re-added formatting to %f --- 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 53ae51a3823a5..22406d2871482 100644 --- a/pandas/core/tools/datetimes.py +++ b/pandas/core/tools/datetimes.py @@ -782,7 +782,7 @@ def to_datetime( `strftime documentation `_ for more information on choices, though - note that "%f" will parse all the way up to nanoseconds. + note that :const:`"%f"` will parse all the way up to nanoseconds. exact : bool, default True Control how `format` is used: