polars.testing.assert_series_not_equal#
- polars.testing.assert_series_not_equal(
- left: Series,
- right: Series,
- *,
- check_dtypes: bool = True,
- check_names: bool = True,
- check_order: bool = True,
- check_exact: bool = False,
- rtol: float = 1e-05,
- atol: float = 1e-08,
- categorical_as_str: bool = False,
Assert that the left and right Series are not equal.
This function is intended for use in unit tests.
- Parameters:
- left
The first Series to compare.
- right
The second Series to compare.
- check_dtypes
Require data types to match.
- check_names
Require names to match.
- check_order
Require elements to appear in the same order.
- check_exact
Require float values to match exactly. If set to
False
, values are considered equal when within tolerance of each other (seertol
andatol
). Only affects columns with a Float data type.- rtol
Relative tolerance for inexact checking, given as a fraction of the values in
right
.- atol
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 string cache.
Examples
>>> from polars.testing import assert_series_not_equal >>> s1 = pl.Series([1, 2, 3]) >>> s2 = pl.Series([1, 2, 3]) >>> assert_series_not_equal(s1, s2) Traceback (most recent call last): ... AssertionError: Series are equal (but are expected not to be)