pandas.testing.assert_series_equal #
- 熊猫测试。assert_series_equal (左,右, check_dtype = True , check_index_type = 'equiv' , check_series_type = True , check_names = True , check_exact = _NoDefault.no_default , check_datetimelike_compat = False , check_categorical = True , check_category_order = True , check_freq = True , check_flags = True , rtol = _NoDefault.no_default , atol = _NoDefault.no_default , obj = 'Series' , * , check_index = True , check_like = False ) [来源] #
检查左右系列是否相等。
- 参数:
- 左系列
- 右系列
- check_dtype bool, 默认 True
是否检查Series dtype是否相同。
- check_index_type bool 或 {'equiv'},默认 'equiv'
是否检查Index类,dtype和inferred_type是否相同。
- check_series_type bool, 默认 True
是否检查Series类是否相同。
- check_names bool, 默认 True
是否检查Series和Index名称属性。
- check_exact bool, 默认 False
是否精确比较数字。
在版本 2.2.0 中更改:
check_exact
如果未指定,rtol
和,则整数数据类型默认为 Trueatol
。- check_datetimelike_compat bool, 默认 False
比较类似 datetime 的结果,忽略 dtype。
- check_categorical bool, 默认 True
是否精确比较内部Categorical。
- check_category_order bool, 默认 True
是否比较内部分类的分类顺序。
- check_freq bool, 默认 True
是否检查DatetimeIndex 或 TimedeltaIndex 的freq属性。
- check_flags bool, 默认 True
是否检查flags属性。
- rtol浮点数,默认 1e-5
相对耐受性。仅当 check_exact 为 False 时使用。
- atol浮点型,默认 1e-8
绝对的宽容。仅当 check_exact 为 False 时使用。
- obj str,默认“系列”
指定正在比较的对象名称,内部用于显示适当的断言消息。
- check_index bool, 默认 True
是否检查索引等价性。如果为 False,则仅比较值。
1.3.0 版本中的新增功能。
- check_like bool, 默认 False
如果为 True,则忽略索引的顺序。如果 check_index 为 False,则必须为 False。注意:相同的标签必须具有相同的数据。
1.5.0 版本中的新增内容。
例子
>>> from pandas import testing as tm >>> a = pd.Series([1, 2, 3, 4]) >>> b = pd.Series([1, 2, 3, 4]) >>> tm.assert_series_equal(a, b)