Skip to content

[DOC]: Explain the choice of absolute/relative tolerance for check_less_precise in assert_almost_equal #21528

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

Closed
rs2 opened this issue Jun 18, 2018 · 3 comments
Labels
Docs good first issue Testing pandas testing functions or related to the test suite
Milestone

Comments

@rs2
Copy link
Contributor

rs2 commented Jun 18, 2018

The docstring in

check_less_precise : bool or int, default False
Specify comparison precision. Only used when check_exact is False.
5 digits (False) or 3 digits (True) after decimal points are compared.
If int, then specify the digits to compare
does not specify how the number of decimal digits is going to be used, yet
if abs(fa) < 1e-5:
if not decimal_almost_equal(fa, fb, decimal):
assert False, ('(very low values) expected %.5f but '
'got %.5f, with decimal %d' % (fb, fa, decimal))
else:
if not decimal_almost_equal(1, fb / fa, decimal):
assert False, ('expected %.5f but got %.5f, '
'with decimal %d' % (fb, fa, decimal))
switches between absolute and relative tolerance depending on the (hardcoded) magnitude on the number.

@gfyoung gfyoung added Testing pandas testing functions or related to the test suite Docs labels Jun 18, 2018
@gfyoung
Copy link
Member

gfyoung commented Jun 18, 2018

@rs2 : Nice catch! Would you like to submit a patch for the docs?

@gfyoung
Copy link
Member

gfyoung commented Jun 18, 2018

Marking for 0.23.2, as this is a relatively trivial thing that we should be able to get in (I can bring this to the finish line if others are unable to do so).

@gfyoung gfyoung added this to the 0.23.2 milestone Jun 18, 2018
@jorisvandenbossche jorisvandenbossche removed this from the 0.23.2 milestone Jun 21, 2018
@jorisvandenbossche
Copy link
Member

@gfyoung removed the milestone. You are of course welcome to do a PR, but I want to keep the milestone focused on the ones that are important for 0.23.2

@jorisvandenbossche jorisvandenbossche added this to the Next Major Release milestone Jun 21, 2018
gfyoung added a commit to forking-repos/pandas that referenced this issue Jun 21, 2018
Note the hard-coded switch between absolute
and relative tolerance during checking.

Closes pandas-devgh-21528.
@gfyoung gfyoung modified the milestones: Next Major Release, 0.24.0 Jun 21, 2018
jreback pushed a commit that referenced this issue Jun 22, 2018
Note the hard-coded switch between absolute
and relative tolerance during checking.

Closes gh-21528.
Sup3rGeo pushed a commit to Sup3rGeo/pandas that referenced this issue Oct 1, 2018
Note the hard-coded switch between absolute
and relative tolerance during checking.

Closes pandas-devgh-21528.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Docs good first issue Testing pandas testing functions or related to the test suite
Projects
None yet
Development

No branches or pull requests

3 participants