pandas.testing.assert_extension_array_equal
- pandas.testing.assert_extension_array_equal(left, right, check_dtype=True, index_values=None, check_less_precise=NoDefault.no_default, check_exact=False, rtol=1e-05, atol=1e-08)[source]
-
Check that left and right ExtensionArrays are equal.
- Parameters
-
- left, right:ExtensionArray
-
The two arrays to compare.
- check_dtype:bool, default True
-
Whether to check if the ExtensionArray dtypes are identical.
- index_values:numpy.ndarray, default None
-
Optional index (shared by both left and right), used in output.
- 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.
Deprecated since version 1.1.0: Use rtol and atol instead to define relative/absolute tolerance, respectively. Similar to
math.isclose()
. - check_exact:bool, default False
-
Whether to compare number exactly.
- rtol:float, default 1e-5
-
Relative tolerance. Only used when check_exact is False.
New in version 1.1.0.
- atol:float, default 1e-8
-
Absolute tolerance. Only used when check_exact is False.
New in version 1.1.0.
Notes
Missing values are checked separately from valid values. A mask of missing values is computed for each and checked to match. The remaining all-valid values are cast to object dtype and checked.
Examples
>>> from pandas.testing import assert_extension_array_equal >>> a = pd.Series([1, 2, 3, 4]) >>> b, c = a.array, a.array >>> assert_extension_array_equal(b, c)
© 2008–2021, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team
Licensed under the 3-clause BSD License.
https://pandas.pydata.org/pandas-docs/version/1.3.4/reference/api/pandas.testing.assert_extension_array_equal.html