Skip to content

Commit

Permalink
Add link to dateutil.parser.parse per review comment by @znicholls
Browse files Browse the repository at this point in the history
  • Loading branch information
danielhuppmann committed Jul 9, 2021
1 parent aa8adb2 commit 5adccd8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
9 changes: 9 additions & 0 deletions pyam/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)

Expand Down

0 comments on commit 5adccd8

Please sign in to comment.