polars.testing.assert_frame_equal#

polars.testing.assert_frame_equal(left: polars.internals.dataframe.frame.DataFrame | polars.internals.lazyframe.frame.LazyFrame, right: polars.internals.dataframe.frame.DataFrame | polars.internals.lazyframe.frame.LazyFrame, check_dtype: bool = True, check_exact: bool = False, check_column_names: bool = True, rtol: float = 1e-05, atol: float = 1e-08, nans_compare_equal: bool = True) None[source]#

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.

nans_compare_equal

if your assert/test requires float NaN != NaN, set this to False.

Examples

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