From 6cfa08b89b8b7fa1753b87f2ca4c96b65d59da30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20Mollier?= <63921018+emollier@users.noreply.github.com> Date: Sun, 10 Nov 2024 20:24:33 +0100 Subject: [PATCH] augur/parse.py: fix test failure with pandas 2.2 (#1471) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This change fixes another case of change in pandas internals causing a breakage in the date parser; initial report is [Debian bug #1071122]. [Debian bug #1071122]: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1071122 Signed-off-by: Étienne Mollier --- augur/parse.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/augur/parse.py b/augur/parse.py index 80b909faa..1aaeec5b5 100644 --- a/augur/parse.py +++ b/augur/parse.py @@ -33,7 +33,12 @@ def fix_dates(d, dayfirst=True): On failure to parse the date, the function will return the input. ''' try: - from pandas.core.tools.datetimes import parsing + try: + # pandas <= 2.1 + from pandas.core.tools.datetimes import parsing + except ImportError: + # pandas >= 2.2 + from pandas._libs.tslibs import parsing try: # pandas 2.x results = parsing.parse_datetime_string_with_reso(d, dayfirst=dayfirst)