From 0f4d2015417aa30f5e50226058edbbeda7384736 Mon Sep 17 00:00:00 2001 From: gfyoung Date: Thu, 21 Jun 2018 14:23:32 -0700 Subject: [PATCH] DOC: Note assert_almost_equal impl. detail Note the hard-coded switch between absolute and relative tolerance during checking. Closes gh-21528. --- pandas/util/testing.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pandas/util/testing.py b/pandas/util/testing.py index b9e53dfc80020..675dd94d49750 100644 --- a/pandas/util/testing.py +++ b/pandas/util/testing.py @@ -224,9 +224,15 @@ def assert_almost_equal(left, right, check_exact=False, check_dtype: bool, default True check dtype if both a and b are the same type check_less_precise : bool or int, default False - Specify comparison precision. Only used when check_exact is 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 + If int, then specify the digits to compare. + + When comparing two numbers, if the first number has magnitude less + than 1e-5, we compare the two numbers directly and check whether + they are equivalent within the specified precision. Otherwise, we + compare the **ratio** of the second number to the first number and + check whether it is equivalent to 1 within the specified precision. """ if isinstance(left, pd.Index): return assert_index_equal(left, right, check_exact=check_exact,