Skip to content

Commit

Permalink
Support pandas v2 (#1671)
Browse files Browse the repository at this point in the history
  • Loading branch information
corneliusroemer authored Nov 13, 2024
1 parent 4b5ad2a commit 3f72c40
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
5 changes: 5 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@

### 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)


[#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)

Expand All @@ -22,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
Expand Down
6 changes: 3 additions & 3 deletions augur/parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down

0 comments on commit 3f72c40

Please sign in to comment.