skbio.util.assert_data_frame_almost_equal#

skbio.util.assert_data_frame_almost_equal(left, right, rtol=1e-05)[source]#

Raise AssertionError if pd.DataFrame objects are not “almost equal”.

Wrapper of pd.util.testing.assert_frame_equal. Floating point values are considered “almost equal” if they are within a threshold defined by assert_frame_equal. This wrapper uses a number of checks that are turned off by default in assert_frame_equal in order to perform stricter comparisons (for example, ensuring the index and column types are the same). It also does not consider empty pd.DataFrame objects 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.DataFrame objects.

Parameters:
left, rightpd.DataFrame

pd.DataFrame objects to compare.

rtolfloat, optional

The relative tolerance parameter used for comparison. Defaults to 1e-5.

Raises:
AssertionError

If left and right are not “almost equal”.

See also

pandas.util.testing.assert_frame_equal