pandas.testing.assert_frame_equal

pandas.testing.assert_frame_equal(left, right, check_dtype=True, check_index_type='equiv', check_column_type='equiv', check_frame_type=True, check_less_precise=False, check_names=True, by_blocks=False, check_exact=False, check_datetimelike_compat=False, check_categorical=True, check_like=False, obj='DataFrame')[source]

Check that left and right DataFrame are equal.

Parameters:
left : DataFrame
right : DataFrame

check_dtype : bool, default True

Whether to check the DataFrame dtype is identical.

check_index_type : bool / string {‘equiv’}, default False

Whether to check the Index class, dtype and inferred_type are identical.

check_column_type : bool / string {‘equiv’}, default False

Whether to check the columns class, dtype and inferred_type are identical.

check_frame_type : bool, default False

Whether to check the DataFrame class is identical.

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

check_names : bool, default True

Whether to check that the names attribute for both the index and column attributes of the DataFrame is identical, i.e.

  • left.index.names == right.index.names
  • left.columns.names == right.columns.names

by_blocks : bool, default False

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.

check_datetimelike_compat : bool, default False

Compare datetime-like which is comparable ignoring dtype.

check_categorical : bool, default True

Whether to compare internal Categorical exactly.

check_like : bool, default False

If true, ignore the order of rows & columns

obj : str, default ‘DataFrame’

Specify object name being compared, internally used to show appropriate assertion message

Scroll To Top