Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support pandas v2 #1671

Merged
merged 4 commits into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading