用法:
cudf.testing.testing.assert_series_equal(left, right, check_dtype=True, check_index_type='equiv', check_series_type=True, check_less_precise=False, 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')
检查左右系列是否相等
此函数旨在比较两个系列并输出任何差异。附加参数允许改变执行的相等检查的严格性。
- left:Series
左系列进行比较
- right:Series
正确的系列进行比较
- check_dtype:布尔值,默认为真
是否检查 Series dtype 是否相同。
- check_index_type:bool 或 {‘equiv’},默认 ‘equiv’
是否检查Index类,dtype和inferred_type是否相同。
- check_series_type:布尔值,默认为真
是否检查系列类,dtype 和inferred_type 是否相同。目前它是空闲的,类似于 Pandas 。
- check_less_precise:bool 或 int,默认为 False
尚不支持
- check_names:布尔值,默认为真
是否检查 Series 的索引和列属性的名称属性是否相同。
- check_exact:布尔值,默认为 False
是否准确比较数字。
- check_datetime_like_compat:布尔值,默认为 False
比较 datetime-like 这是可比较的忽略 dtype。
- check_categorical:布尔值,默认为真
是否准确比较内部分类。
- check_category_order:布尔值,默认为真
是否比较内部Categoricals的类别顺序
- rtol:浮点数,默认 1e-5
相对容差。仅在
check_exact
为 False 时使用。- atol:浮点数,默认 1e-8
绝对的宽容。仅在
check_exact
为 False 时使用。- obj:str,默认“系列”
指定要比较的对象名称,内部用于显示适当的断言消息。
参数:
例子:
>>> 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
这将顺利通过:
>>> sr2 = cudf.Series([1, 2, 3, 4], name="a") >>> cudf.testing.assert_series_equal(sr1, sr2)
相关用法
- Python cudf.testing.testing.assert_index_equal用法及代码示例
- Python cudf.testing.testing.assert_frame_equal用法及代码示例
- Python cudf.to_numeric用法及代码示例
- Python cudf.to_datetime用法及代码示例
- Python cudf.core.column.string.StringMethods.is_vowel用法及代码示例
- Python cudf.Series.ceil用法及代码示例
- Python cudf.core.column.string.StringMethods.endswith用法及代码示例
- Python cudf.Series.update用法及代码示例
- Python cudf.DataFrame.mod用法及代码示例
- Python cudf.DataFrame.isin用法及代码示例
- Python cudf.core.column.string.StringMethods.title用法及代码示例
- Python cudf.DataFrame.rmul用法及代码示例
- Python cudf.Series.max用法及代码示例
- Python cudf.DatetimeIndex.dayofweek用法及代码示例
- Python cudf.DataFrame.apply用法及代码示例
- Python cudf.core.column.string.StringMethods.contains用法及代码示例
- Python cudf.core.column.string.StringMethods.rsplit用法及代码示例
- Python cudf.DataFrame.exp用法及代码示例
- Python cudf.Series.head用法及代码示例
- Python cudf.DataFrame.drop用法及代码示例
注:本文由纯净天空筛选整理自rapids.ai大神的英文原创作品 cudf.testing.testing.assert_series_equal。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。