pyspark.pandas.testing.assert_series_equal#
- pyspark.pandas.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, check_freq=True, check_flags=True, rtol=1e-05, atol=1e-08, obj='Series', *, check_index=True, check_like=False)[source]#
Check that left and right Series are equal.
New in version 4.0.0.
- Parameters
- leftSeries
- rightSeries
- 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 is identical.
- check_namesbool, default True
Whether to check the Series and Index names attribute.
- check_exactbool, default False
Whether to compare number exactly.
- check_datetimelike_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.
- check_freqbool, default True
Whether to check the freq attribute on a DatetimeIndex or TimedeltaIndex.
- check_flagsbool, default True
Whether to check the flags attribute.
- 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.
- check_indexbool, default True
Whether to check index equivalence. If False, then compare only values.
- check_likebool, default False
If True, ignore the order of the index. Must be False if check_index is False. Note: same labels must be with the same data.
Examples
>>> from pyspark.pandas import testing as tm >>> a = ps.Series([1, 2, 3, 4]) >>> b = ps.Series([1, 2, 3, 4]) >>> tm.assert_series_equal(a, b)