Fix Python 3.12+ SyntaxWarning and pandas 3.0 compatibility#80
Open
AlJohri wants to merge 2 commits into
Open
Conversation
- Fix invalid escape sequences in LaTeX strings in report.py - Use pd.api.types.is_string_dtype() instead of dtype == "O" checks in qrels.py and run.py for pandas 3.0 StringDtype compatibility
Author
|
Fixes #79 |
Collaborator
|
@AmenRa looks good to me, any concerns merging this? |
The typos spell checker flags scipy's ttest_rel as a misspelling.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes two issues encountered when using ranx with Python 3.12+ and pandas 3.0:
SyntaxWarning: invalid escape sequence— LaTeX strings inreport.pyused unescaped backslashes (e.g.\centering,\le,\midrule,\end,\label) which Python 3.12+ warns about and future versions will make aSyntaxError.AssertionError: DataFrame Query IDs column dtype must be 'object' (string)—qrels.pyandrun.pycheckeddtype == "O"to validate string columns, but pandas 3.0 defaults toStringDtypeinstead ofobjectfor string columns. Replaced withpd.api.types.is_string_dtype()which handles both.Test plan
pytest— 124 passed, 0 failed (previously 6 failures from the dtype issue)SyntaxWarningon Python 3.11, 3.12, and 3.13