Repository navigation
Fix argument order in fisher_exact docstring example - #411
Merged
Merged
Conversation
The example passed TN and FN in swapped positions relative to the signature fisher_exact(tp, fp, fn, tn). Fixes pyranges#391.
Mohit-Ak
marked this pull request as ready for review
October 24, 2026 21:52
Collaborator
|
Thanks! 😳 |
Collaborator
|
This also exists in v1 it seems. I'll get my clanker to fix it. Thanks for reporting. I'll have it go through and analyze all the math equations. |
endrebak
added a commit
to pyranges/pyranges1
that referenced
this pull request
Oct 27, 2026
Bump the version and add the fisher_exact docstring fix to CHANGELOG.txt and the README changelog. The fix was found and made by Mohit Arvind Khakharia (@Mohit-Ak) in pyranges/pyranges0#411; this branch ports it. The README changelog also gains the missing 1.5.1 entry. Co-authored-by: Mohit Arvind Khakharia <6740115+Mohit-Ak@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
endrebak
added a commit
to pyranges/pyranges1
that referenced
this pull request
Oct 27, 2026
* Fix argument order in fisher_exact docstring example The example passed TN before FN, but the signature is fisher_exact(tp, fp, fn, tn). Port of pyranges/pyranges0#411. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YSQEBfFhfhK1o1XRsbHtcP * Release 1.5.2, crediting @Mohit-Ak for the fisher_exact fix Bump the version and add the fisher_exact docstring fix to CHANGELOG.txt and the README changelog. The fix was found and made by Mohit Arvind Khakharia (@Mohit-Ak) in pyranges/pyranges0#411; this branch ports it. The README changelog also gains the missing 1.5.1 entry. Co-authored-by: Mohit Arvind Khakharia <6740115+Mohit-Ak@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Mohit Arvind Khakharia <6740115+Mohit-Ak@users.noreply.github.com>
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.
The
fisher_exactdocstring example calledpr.stats.fisher_exact(df.TP, df.FP, df.TN, df.FN), but the signature isfisher_exact(tp, fp, fn, tn), so the example passed TN and FN in each other's slots and showed the odds ratio and p-values for the wrong table.This passes the columns in signature order and updates the expected output. The new values match
scipy.stats.fisher_exact([[tp, fp], [fn, tn]])for both rows (OR 34.8 / 0.0), and they line up with the odds-ratio formula in the Notes section.Tested:
pytest --doctest-modules pyranges/statistics.pyandpytest tests/unitpass on pandas 3.1 and 2.3. isort, black and flake8 are clean, with the same settings as CI.Fixes #391