cudf.testing.testing.assert_series_equal#
- cudf.testing.testing.assert_series_equal(left, right, check_dtype=True, check_index_type='equiv', check_series_type=True, check_names=True, check_exact=False, check_datetimelike_compat=False, check_categorical=True, check_category_order=True, rtol=1e-05, atol=1e-08, obj='Series')#
Check that left and right Series are equal
This function is intended to compare two Series and output any differences. Additional parameters allow varying the strictness of the equality checks performed.
- Parameters:
- leftSeries
left Series to compare
- rightSeries
right Series to compare
- check_dtypebool, default True
Whether to check the Series dtype is identical.
- check_index_typebool or {‘equiv’}, default ‘equiv’
Whether to check the Index class, dtype and inferred_type are identical.
- check_series_typebool, default True
Whether to check the series class, dtype and inferred_type are identical. Currently it is idle, and similar to pandas.
- check_namesbool, default True
Whether to check that the names attribute for both the index and column attributes of the Series is identical.
- check_exactbool, default False
Whether to compare number exactly.
- check_datetime_like_compatbool, default False
Compare datetime-like which is comparable ignoring dtype.
- check_categoricalbool, default True
Whether to compare internal Categorical exactly.
- check_category_orderbool, default True
Whether to compare category order of internal Categoricals
- rtolfloat, default 1e-5
Relative tolerance. Only used when check_exact is False.
- atolfloat, default 1e-8
Absolute tolerance. Only used when check_exact is False.
- objstr, default ‘Series’
Specify object name being compared, internally used to show appropriate assertion message.
Examples
>>> import cudf >>> sr1 = cudf.Series([1, 2, 3, 4], name="a") >>> sr2 = cudf.Series([1, 2, 3, 5], name="b") >>> cudf.testing.assert_series_equal(sr1, sr2) ...... ...... AssertionError: ColumnBase are different values are different (25.0 %) [left]: [1 2 3 4] [right]: [1 2 3 5]
>>> sr2 = cudf.Series([1, 2, 3, 4], name="b") >>> cudf.testing.assert_series_equal(sr1, sr2) ...... ...... AssertionError: Series are different name mismatch [left]: a [right]: b
This will pass without any hitch:
>>> sr2 = cudf.Series([1, 2, 3, 4], name="a") >>> cudf.testing.assert_series_equal(sr1, sr2)