Skip to content

Commit

Permalink
Update call and expected returns from pandas's parse_time_string
Browse files Browse the repository at this point in the history
The API for `parse_time_string` changed recently to only return two values
instead of three [1] and the function is no longer importable from the pandas
core tools datetimes module as of version 1.1.0. Instead, we have to import the
`parsing` module that exposes the `parse_time_string` function.

This bug should affect anyone trying to run augur with pandas 1.1.0 but not
users running earlier versions of pandas.

[1] pandas-dev/pandas#31065
  • Loading branch information
huddlej committed Aug 11, 2020
1 parent 76c04eb commit ad57d66
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion augur/parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ def fix_dates(d, dayfirst=True):
On failure to parse the date, the function will return the input.
'''
try:
dto, _, res = pd.core.tools.datetimes.parse_time_string(d, dayfirst=dayfirst)
from pandas.core.tools.datetimes import parsing
dto, res = parsing.parse_time_string(d, dayfirst=dayfirst)
if res == 'year':
return "%d-XX-XX"%dto.year
elif res == 'month':
Expand Down

0 comments on commit ad57d66

Please sign in to comment.