From 5adccd81a8416aac3ed185b7bd33a7bb7c0cb515 Mon Sep 17 00:00:00 2001 From: Daniel Huppmann Date: Fri, 9 Jul 2021 10:45:04 +0200 Subject: [PATCH] Add link to `dateutil.parser.parse` per review comment by @znicholls --- doc/source/conf.py | 1 + pyam/core.py | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/doc/source/conf.py b/doc/source/conf.py index e6a0c3e70..b64265cd8 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -324,6 +324,7 @@ # Intersphinx configuration. intersphinx_mapping = { "python": ("https://docs.python.org/3", None), + "dateutil": ("https://dateutil.readthedocs.io/en/stable/", None), "numpy": ("https://numpy.org/doc/stable/", None), "pandas": ("https://pandas.pydata.org/pandas-docs/stable/", None), "pint": ("https://pint.readthedocs.io/en/stable", None), diff --git a/pyam/core.py b/pyam/core.py index 5946230e4..2be98e10f 100755 --- a/pyam/core.py +++ b/pyam/core.py @@ -637,12 +637,20 @@ def swap_time_for_year(self, subannual=False, inplace=False): See Also -------- swap_year_for_time + """ return swap_time_for_year(self, subannual=subannual, inplace=inplace) def swap_year_for_time(self, inplace=False): """Convert the `year` and `subannual` dimensions to `time` (as datetime). + The method applies :meth:`dateutil.parser.parse` on the combined columns + `year` and `subannual`: + + .. code-block:: python + + dateutil.parser.parse([f"{y}-{s}" for y, s in zip(year, subannual)]) + Parameters ---------- inplace : bool, optional @@ -661,6 +669,7 @@ def swap_year_for_time(self, inplace=False): See Also -------- swap_time_for_year + """ return swap_year_for_time(self, inplace=inplace)