用法:
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。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。