From c76fce7eb0d6981ec882d378158c81c928455977 Mon Sep 17 00:00:00 2001 From: Cornelius Roemer Date: Tue, 12 Nov 2024 14:42:56 +0100 Subject: [PATCH 1/4] Ensure types are v2 pandas ready --- augur/parse.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/augur/parse.py b/augur/parse.py index 1aaeec5b5..7e1a094ee 100644 --- a/augur/parse.py +++ b/augur/parse.py @@ -25,7 +25,7 @@ '\\': '_'} ) -def fix_dates(d, dayfirst=True): +def fix_dates(d: str, dayfirst: bool = True) -> str: ''' attempt to parse a date string using pandas date parser. If ambiguous, the argument 'dayfirst' determines whether month or day is assumed to be @@ -35,7 +35,7 @@ def fix_dates(d, dayfirst=True): try: try: # pandas <= 2.1 - from pandas.core.tools.datetimes import parsing + from pandas.core.tools.datetimes import parsing # type: ignore except ImportError: # pandas >= 2.2 from pandas._libs.tslibs import parsing @@ -44,7 +44,7 @@ def fix_dates(d, dayfirst=True): results = parsing.parse_datetime_string_with_reso(d, dayfirst=dayfirst) except AttributeError: # pandas 1.x - results = parsing.parse_time_string(d, dayfirst=dayfirst) + results = parsing.parse_time_string(d, dayfirst=dayfirst) # type: ignore if len(results) == 2: dto, res = results else: From 636b60cba9dd8bbde384c8783f0bc9a7ad6c63be Mon Sep 17 00:00:00 2001 From: Cornelius Roemer Date: Tue, 12 Nov 2024 14:44:14 +0100 Subject: [PATCH 2/4] Support pandas v2 --- setup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index a924fe534..863e67fa0 100644 --- a/setup.py +++ b/setup.py @@ -61,7 +61,7 @@ "networkx >= 2.5, <4", "numpy ==1.*", "packaging >=19.2", - "pandas >=1.0.0, ==1.*", + "pandas >=1.0.0, <3", "phylo-treetime >=0.11.2, <0.12", "pyfastx >=1.0.0, <3.0", "python_calamine >=0.2.0", @@ -76,7 +76,7 @@ "freezegun >=0.3.15", "mypy", "nextstrain-sphinx-theme >=2022.5", - "pandas-stubs >=1.0.0, ==1.*", + "pandas-stubs >=1.0.0, <3", "pylint >=1.7.6", "pytest >=5.4.1", "pytest-cov >=2.8.1", From d822fdf9d1463acf0344062748d3aae45a21118a Mon Sep 17 00:00:00 2001 From: Cornelius Roemer Date: Tue, 12 Nov 2024 14:48:33 +0100 Subject: [PATCH 3/4] Update changelog --- CHANGES.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index 297f92ba2..4b1315107 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -5,10 +5,17 @@ ### Features - curate: change output metadata to [RFC 4180 CSV-like TSVs][] to match the TSV format output by other Augur subcommands and the Nextstrain ecosystem as discussed in [#1566][]. [#1565][] (@joverlee521) +- Support pandas v2. [#1671] (@corneliusroemer and @victorlin) +### Bug fixes + +- parse: fix test failure with pandas 2.2. [#1471] (@emollier) + +[#1471]: https://github.com/nextstrain/augur/pull/1471 [#1565]: https://github.com/nextstrain/augur/pull/1565 [#1566]: https://github.com/nextstrain/augur/issues/1566 [RFC 4180 CSV-like TSVs]: https://datatracker.ietf.org/doc/html/rfc4180 +[#1671]: https://github.com/nextstrain/augur/pull/1671 ## 26.1.0 (12 November 2024) From 5b4efab526113f06f9246c7a2a96769f0d5fb688 Mon Sep 17 00:00:00 2001 From: Cornelius Roemer Date: Wed, 13 Nov 2024 13:24:31 +0100 Subject: [PATCH 4/4] Fix CHANGELOG --- CHANGES.md | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 4b1315107..7cfe82974 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -4,14 +4,10 @@ ### Features +- support pandas v2. [#1671] (@corneliusroemer and @victorlin) - curate: change output metadata to [RFC 4180 CSV-like TSVs][] to match the TSV format output by other Augur subcommands and the Nextstrain ecosystem as discussed in [#1566][]. [#1565][] (@joverlee521) -- Support pandas v2. [#1671] (@corneliusroemer and @victorlin) -### Bug fixes - -- parse: fix test failure with pandas 2.2. [#1471] (@emollier) -[#1471]: https://github.com/nextstrain/augur/pull/1471 [#1565]: https://github.com/nextstrain/augur/pull/1565 [#1566]: https://github.com/nextstrain/augur/issues/1566 [RFC 4180 CSV-like TSVs]: https://datatracker.ietf.org/doc/html/rfc4180 @@ -29,7 +25,9 @@ * index: Previously specifying a directory that does not exist in the path to `--output` would result in an incorrect error stating that the input file does not exist. It now shows the correct path responsible for the error. [#1644][] (@victorlin) * curate format-dates: Update help docs and improve failure messages to show use of `--expected-date-formats`. [#1653][] (@joverlee521) +* parse: fix test failure with pandas 2.2. [#1471] (@emollier) +[#1471]: https://github.com/nextstrain/augur/pull/1471 [#1644]: https://github.com/nextstrain/augur/issues/1644 [#1547]: https://github.com/nextstrain/augur/pull/1547 [#1653]: https://github.com/nextstrain/augur/pull/1653