assert_series_equal

Function assert_series_equal 

Source
pub fn assert_series_equal(
    left: &Series,
    right: &Series,
    options: SeriesEqualOptions,
) -> PolarsResult<()>
Expand description

Verifies that two Series are equal according to a set of configurable criteria.

This function serves as the main entry point for comparing Series, checking various metadata properties before comparing the actual values.

§Arguments

  • left - The first Series to compare
  • right - The second Series to compare
  • options - A SeriesEqualOptions struct containing configuration parameters:
    • check_names - If true, verifies Series names match
    • check_dtypes - If true, verifies data types match
    • check_order - If true, elements must be in the same order
    • check_exact - If true, requires exact equality for float values
    • rel_tol - Relative tolerance for float comparison
    • abs_tol - Absolute tolerance for float comparison
    • categorical_as_str - If true, converts categorical Series to strings before comparison

§Returns

  • Ok(()) if Series match according to all specified criteria
  • Err with details about the first mismatch encountered:
    • Length mismatch
    • Name mismatch (if checking names)
    • Data type mismatch (if checking dtypes)
    • Value mismatches (via assert_series_values_equal)

§Order of Checks

  1. Series length
  2. Series names (if check_names is true)
  3. Data types (if check_dtypes is true)
  4. Series values (delegated to assert_series_values_equal)