polars.testing.assert_frame_not_equal
-
Assert that the left and right frame are not equal.
This function is intended for use in unit tests.
Changed in version 0.20.31: The
check_dtypeparameter was renamedcheck_dtypes.Changed in version 1.32.3: The
rtolandatolparameters were renamed torel_tolandabs_tol, respectively.- Parameters:
-
- left
-
The first DataFrame or LazyFrame to compare.
- right
-
The second DataFrame or LazyFrame to compare.
- check_row_order
-
Requires row order to match.
- check_column_order
-
Requires column order to match.
- check_dtypes
-
Requires data types to match.
- check_exact
-
Requires float values to match exactly. If set to
False, values are considered equal when within tolerance of each other (seerel_tolandabs_tol). Only affects columns with a Float data type. - rel_tol
-
Relative tolerance for inexact checking. Fraction of values in
right. - abs_tol
-
Absolute tolerance for inexact checking.
- categorical_as_str
-
Cast categorical columns to string before comparing. Enabling this helps compare columns that do not share the same categories.
Examples
>>> from polars.testing import assert_frame_not_equal >>> df1 = pl.DataFrame({"a": [1, 2, 3]}) >>> df2 = pl.DataFrame({"a": [1, 2, 3]}) >>> assert_frame_not_equal(df1, df2) Traceback (most recent call last): ... AssertionError: DataFrames are equal (but are expected not to be)
polars.testing.assert_frame_not_equal(
left: DataFrame | LazyFrame,
right: DataFrame | LazyFrame,
*,
check_row_order: bool = True,
check_column_order: bool = True,
check_dtypes: bool = True,
check_exact: bool = False,
rel_tol: float = 1e-05,
abs_tol: float = 1e-08,
categorical_as_str: bool = False,
) → None
© 2020 Ritchie Vink
© 2022 Polars contributors
Licensed under the MIT License.
https://docs.pola.rs/api/python/stable/reference/api/polars.testing.assert_frame_not_equal.html