skbio.util.assert_data_frame_almost_equal¶
- skbio.util.assert_data_frame_almost_equal(left, right, rtol=1e-05)[source]¶
Raise AssertionError if
pd.DataFrameobjects are not “almost equal”.State: Experimental as of 0.4.0.
Wrapper of
pd.util.testing.assert_frame_equal. Floating point values are considered “almost equal” if they are within a threshold defined byassert_frame_equal. This wrapper uses a number of checks that are turned off by default inassert_frame_equalin order to perform stricter comparisons (for example, ensuring the index and column types are the same). It also does not consider emptypd.DataFrameobjects equal if they have a different index.Other notes:
Index (row) and column ordering must be the same for objects to be equal.
NaNs (
np.nan) in the same locations are considered equal.
This is a helper function intended to be used in unit tests that need to compare
pd.DataFrameobjects.- Parameters
left (pd.DataFrame) –
pd.DataFrameobjects to compare.right (pd.DataFrame) –
pd.DataFrameobjects to compare.
- Raises
AssertionError – If left and right are not “almost equal”.
See also
pandas.util.testing.assert_frame_equal