Skip to content

Commit 3f72c40

Browse files
Support pandas v2 (#1671)
1 parent 4b5ad2a commit 3f72c40

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

CHANGES.md

+5
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,14 @@
44

55
### Features
66

7+
- support pandas v2. [#1671] (@corneliusroemer and @victorlin)
78
- 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)
89

10+
911
[#1565]: https://github.com/nextstrain/augur/pull/1565
1012
[#1566]: https://github.com/nextstrain/augur/issues/1566
1113
[RFC 4180 CSV-like TSVs]: https://datatracker.ietf.org/doc/html/rfc4180
14+
[#1671]: https://github.com/nextstrain/augur/pull/1671
1215

1316
## 26.1.0 (12 November 2024)
1417

@@ -22,7 +25,9 @@
2225

2326
* 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)
2427
* curate format-dates: Update help docs and improve failure messages to show use of `--expected-date-formats`. [#1653][] (@joverlee521)
28+
* parse: fix test failure with pandas 2.2. [#1471] (@emollier)
2529

30+
[#1471]: https://github.com/nextstrain/augur/pull/1471
2631
[#1644]: https://github.com/nextstrain/augur/issues/1644
2732
[#1547]: https://github.com/nextstrain/augur/pull/1547
2833
[#1653]: https://github.com/nextstrain/augur/pull/1653

augur/parse.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
'\\': '_'}
2626
)
2727

28-
def fix_dates(d, dayfirst=True):
28+
def fix_dates(d: str, dayfirst: bool = True) -> str:
2929
'''
3030
attempt to parse a date string using pandas date parser. If ambiguous,
3131
the argument 'dayfirst' determines whether month or day is assumed to be
@@ -35,7 +35,7 @@ def fix_dates(d, dayfirst=True):
3535
try:
3636
try:
3737
# pandas <= 2.1
38-
from pandas.core.tools.datetimes import parsing
38+
from pandas.core.tools.datetimes import parsing # type: ignore
3939
except ImportError:
4040
# pandas >= 2.2
4141
from pandas._libs.tslibs import parsing
@@ -44,7 +44,7 @@ def fix_dates(d, dayfirst=True):
4444
results = parsing.parse_datetime_string_with_reso(d, dayfirst=dayfirst)
4545
except AttributeError:
4646
# pandas 1.x
47-
results = parsing.parse_time_string(d, dayfirst=dayfirst)
47+
results = parsing.parse_time_string(d, dayfirst=dayfirst) # type: ignore
4848
if len(results) == 2:
4949
dto, res = results
5050
else:

setup.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
"networkx >= 2.5, <4",
6262
"numpy ==1.*",
6363
"packaging >=19.2",
64-
"pandas >=1.0.0, ==1.*",
64+
"pandas >=1.0.0, <3",
6565
"phylo-treetime >=0.11.2, <0.12",
6666
"pyfastx >=1.0.0, <3.0",
6767
"python_calamine >=0.2.0",
@@ -76,7 +76,7 @@
7676
"freezegun >=0.3.15",
7777
"mypy",
7878
"nextstrain-sphinx-theme >=2022.5",
79-
"pandas-stubs >=1.0.0, ==1.*",
79+
"pandas-stubs >=1.0.0, <3",
8080
"pylint >=1.7.6",
8181
"pytest >=5.4.1",
8282
"pytest-cov >=2.8.1",

0 commit comments

Comments
 (0)