Skip to content

Commit ac56856

Browse files
gfyoungjreback
authored andcommitted
DOC: Note assert_almost_equal impl. detail (#21580)
Note the hard-coded switch between absolute and relative tolerance during checking. Closes gh-21528.
1 parent c2b03e4 commit ac56856

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

pandas/util/testing.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -224,9 +224,15 @@ def assert_almost_equal(left, right, check_exact=False,
224224
check_dtype: bool, default True
225225
check dtype if both a and b are the same type
226226
check_less_precise : bool or int, default False
227-
Specify comparison precision. Only used when check_exact is False.
227+
Specify comparison precision. Only used when `check_exact` is False.
228228
5 digits (False) or 3 digits (True) after decimal points are compared.
229-
If int, then specify the digits to compare
229+
If int, then specify the digits to compare.
230+
231+
When comparing two numbers, if the first number has magnitude less
232+
than 1e-5, we compare the two numbers directly and check whether
233+
they are equivalent within the specified precision. Otherwise, we
234+
compare the **ratio** of the second number to the first number and
235+
check whether it is equivalent to 1 within the specified precision.
230236
"""
231237
if isinstance(left, pd.Index):
232238
return assert_index_equal(left, right, check_exact=check_exact,

0 commit comments

Comments
 (0)