From 309a822fb5d5b58d6407dc7cad143fd35f282671 Mon Sep 17 00:00:00 2001 From: mtelfer Date: Wed, 29 Apr 2020 11:00:52 +0100 Subject: [PATCH 1/4] DOC: timezone warning for DST beyond 2038-01-19 --- doc/source/user_guide/timeseries.rst | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/doc/source/user_guide/timeseries.rst b/doc/source/user_guide/timeseries.rst index 6ba58310000cb..7fe87ccaa9ff7 100644 --- a/doc/source/user_guide/timeseries.rst +++ b/doc/source/user_guide/timeseries.rst @@ -2265,6 +2265,20 @@ you can use the ``tz_convert`` method. Instead, the datetime needs to be localized using the ``localize`` method on the ``pytz`` time zone object. +.. warning:: + + If you are using dates beyond 18 Jan 2038, note that pandas does not apply daylight saving time adjustments to timezone aware dates. This is partly because the underlying libraries do not currently address the Year 2038 Problem, and partly because there is some discussion on how reliable any DST settings that far into the future will be. + + For example, for two dates that are in British Summer Time and so would normally be GMT+1, both the following evaluate as true: + + .. ipython:: python + d_2037 = '2037-03-31T010101' + d_2038 = '2038-03-31T010101' + DST = 'Europe/London' + assert pd.Timestamp(d_2037, tz=) != pd.Timestamp(d_2037, tz='GMT') + assert pd.Timestamp(d_2037, tz=) != pd.Timestamp(d_2037, tz='GMT') + assert pd.Timestamp(d_2038, tz='Europe/London') == pd.Timestamp(d_2038, tz='GMT') + Under the hood, all timestamps are stored in UTC. Values from a time zone aware :class:`DatetimeIndex` or :class:`Timestamp` will have their fields (day, hour, minute, etc.) localized to the time zone. However, timestamps with the same UTC value are From 42d827fdced6810b6010497b0386b883102794c6 Mon Sep 17 00:00:00 2001 From: mtelfer Date: Wed, 29 Apr 2020 13:39:40 +0100 Subject: [PATCH 2/4] fixes rst alignment and line length errors --- doc/source/user_guide/timeseries.rst | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/doc/source/user_guide/timeseries.rst b/doc/source/user_guide/timeseries.rst index 7fe87ccaa9ff7..222a8d07c9b6c 100644 --- a/doc/source/user_guide/timeseries.rst +++ b/doc/source/user_guide/timeseries.rst @@ -2269,15 +2269,15 @@ you can use the ``tz_convert`` method. If you are using dates beyond 18 Jan 2038, note that pandas does not apply daylight saving time adjustments to timezone aware dates. This is partly because the underlying libraries do not currently address the Year 2038 Problem, and partly because there is some discussion on how reliable any DST settings that far into the future will be. - For example, for two dates that are in British Summer Time and so would normally be GMT+1, both the following evaluate as true: + For example, for two dates that are in British Summer Time and so would normally be GMT+1, both the following asserts evaluate as true: .. ipython:: python + d_2037 = '2037-03-31T010101' - d_2038 = '2038-03-31T010101' - DST = 'Europe/London' - assert pd.Timestamp(d_2037, tz=) != pd.Timestamp(d_2037, tz='GMT') - assert pd.Timestamp(d_2037, tz=) != pd.Timestamp(d_2037, tz='GMT') - assert pd.Timestamp(d_2038, tz='Europe/London') == pd.Timestamp(d_2038, tz='GMT') + d_2038 = '2038-03-31T010101' + DST = 'Europe/London' + assert pd.Timestamp(d_2037, tz=DST) != pd.Timestamp(d_2037, tz='GMT') + assert pd.Timestamp(d_2038, tz=DST) == pd.Timestamp(d_2038, tz='GMT') Under the hood, all timestamps are stored in UTC. Values from a time zone aware :class:`DatetimeIndex` or :class:`Timestamp` will have their fields (day, hour, minute, etc.) From 16f5c6e7cf4dca1fb572d40d0c0bf2417b882aeb Mon Sep 17 00:00:00 2001 From: telferm57 Date: Fri, 1 May 2020 12:00:14 +0100 Subject: [PATCH 3/4] DOC: further textual changes --- doc/source/user_guide/timeseries.rst | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/doc/source/user_guide/timeseries.rst b/doc/source/user_guide/timeseries.rst index 222a8d07c9b6c..1e86e17b87796 100644 --- a/doc/source/user_guide/timeseries.rst +++ b/doc/source/user_guide/timeseries.rst @@ -2267,7 +2267,11 @@ you can use the ``tz_convert`` method. .. warning:: - If you are using dates beyond 18 Jan 2038, note that pandas does not apply daylight saving time adjustments to timezone aware dates. This is partly because the underlying libraries do not currently address the Year 2038 Problem, and partly because there is some discussion on how reliable any DST settings that far into the future will be. + If you are using dates beyond 2038-01-18, due to current deficiencies + in the underlying libraries caused by the year 2038 problem, daylight saving time (DST) adjustments + to timezone aware dates will not be applied. If and when the underlying libraries are fixed, + the DST transitions will be applied. It should be noted though, that time zone data for far future time zones + are likely to be inaccurate, as they are simple extrapolations of the current set of (regularly revised) rules. For example, for two dates that are in British Summer Time and so would normally be GMT+1, both the following asserts evaluate as true: @@ -2276,8 +2280,8 @@ you can use the ``tz_convert`` method. d_2037 = '2037-03-31T010101' d_2038 = '2038-03-31T010101' DST = 'Europe/London' - assert pd.Timestamp(d_2037, tz=DST) != pd.Timestamp(d_2037, tz='GMT') - assert pd.Timestamp(d_2038, tz=DST) == pd.Timestamp(d_2038, tz='GMT') + assert pd.Timestamp(d_2037, tz=DST) != pd.Timestamp(d_2037, tz='GMT') # expected + assert pd.Timestamp(d_2038, tz=DST) == pd.Timestamp(d_2038, tz='GMT') # not expected Under the hood, all timestamps are stored in UTC. Values from a time zone aware :class:`DatetimeIndex` or :class:`Timestamp` will have their fields (day, hour, minute, etc.) From 3186296cffb4bac5201aa60b1b77f5accce99f9f Mon Sep 17 00:00:00 2001 From: telferm57 Date: Fri, 1 May 2020 18:01:55 +0100 Subject: [PATCH 4/4] DOC: delints line length issues --- doc/source/user_guide/timeseries.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/source/user_guide/timeseries.rst b/doc/source/user_guide/timeseries.rst index 1e86e17b87796..a88cb22bd0767 100644 --- a/doc/source/user_guide/timeseries.rst +++ b/doc/source/user_guide/timeseries.rst @@ -2273,15 +2273,15 @@ you can use the ``tz_convert`` method. the DST transitions will be applied. It should be noted though, that time zone data for far future time zones are likely to be inaccurate, as they are simple extrapolations of the current set of (regularly revised) rules. - For example, for two dates that are in British Summer Time and so would normally be GMT+1, both the following asserts evaluate as true: + For example, for two dates that are in British Summer Time (and so would normally be GMT+1), both the following asserts evaluate as true: .. ipython:: python d_2037 = '2037-03-31T010101' d_2038 = '2038-03-31T010101' DST = 'Europe/London' - assert pd.Timestamp(d_2037, tz=DST) != pd.Timestamp(d_2037, tz='GMT') # expected - assert pd.Timestamp(d_2038, tz=DST) == pd.Timestamp(d_2038, tz='GMT') # not expected + assert pd.Timestamp(d_2037, tz=DST) != pd.Timestamp(d_2037, tz='GMT') + assert pd.Timestamp(d_2038, tz=DST) == pd.Timestamp(d_2038, tz='GMT') Under the hood, all timestamps are stored in UTC. Values from a time zone aware :class:`DatetimeIndex` or :class:`Timestamp` will have their fields (day, hour, minute, etc.)