polars.testing.assert_frame_equal

polars.testing.assert_frame_equal(left: polars.internals.frame.DataFrame, right: polars.internals.frame.DataFrame, check_dtype: bool = True, check_exact: bool = False, check_column_names: bool = True, rtol: float = 1e-05, atol: float = 1e-08) None

Raise detailed AssertionError if left does not equal right.

Parameters
left

the dataframe to compare

right

the dataframe to compare with

check_dtype

if True, data types need to match exactly

check_exact

if False, test if values are within tolerance of each other (see rtol & atol)

check_column_names

if True, dataframes must have the same column names in the same order

rtol

relative tolerance for inexact checking. Fraction of values in right

atol

absolute tolerance for inexact checking.

Examples

>>> df1 = pl.DataFrame({"a": [1, 2, 3]})
>>> df2 = pl.DataFrame({"a": [2, 3, 4]})
>>> pl.testing.assert_frame_equal(df1, df2)