From 3ebd19f5e4ebbacb2a434e421ffb7d28f55f1cee Mon Sep 17 00:00:00 2001 From: Yi-Han Chen Date: Tue, 6 Aug 2024 19:10:45 -0700 Subject: [PATCH 1/2] docs: Enhance the usage of rtol and atol arguments in pd.testing.assert_frame_equal --- pandas/_testing/asserters.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pandas/_testing/asserters.py b/pandas/_testing/asserters.py index d52dabe47279a..3368cb2915606 100644 --- a/pandas/_testing/asserters.py +++ b/pandas/_testing/asserters.py @@ -1158,7 +1158,10 @@ def assert_frame_equal( Specify how to compare internal data. If False, compare by columns. If True, compare by blocks. check_exact : bool, default False - Whether to compare number exactly. + Whether to compare number exactly. If False, the comparison uses the + relative tolerance (`rtol`) and absolute tolerance (`atol`) + parameters to determine if two values are considered close, + according to the formula: `|a - b| <= (atol + rtol * |b|)`. .. versionchanged:: 2.2.0 From fa640916fd1e0912a9f2a79c9b68573ddd0cbd4d Mon Sep 17 00:00:00 2001 From: Yi-Han Chen Date: Wed, 7 Aug 2024 17:10:01 -0700 Subject: [PATCH 2/2] pr: Fix review --- pandas/_testing/asserters.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandas/_testing/asserters.py b/pandas/_testing/asserters.py index 3368cb2915606..9faf1ca791998 100644 --- a/pandas/_testing/asserters.py +++ b/pandas/_testing/asserters.py @@ -1159,9 +1159,9 @@ def assert_frame_equal( If True, compare by blocks. check_exact : bool, default False Whether to compare number exactly. If False, the comparison uses the - relative tolerance (`rtol`) and absolute tolerance (`atol`) + relative tolerance (``rtol``) and absolute tolerance (``atol``) parameters to determine if two values are considered close, - according to the formula: `|a - b| <= (atol + rtol * |b|)`. + according to the formula: ``|a - b| <= (atol + rtol * |b|)``. .. versionchanged:: 2.2.0