用法:
Series.equals(other, **kwargs)
測試兩個對象是否包含相同的元素。此函數允許將兩個 Series 或 DataFrame 相互比較,以查看它們是否具有相同的形狀和元素。同一位置的 NaN 被認為是相等的。列標題不需要具有相同的類型。
- other:Series或DataFrame
要與第一個進行比較的其他 Series 或 DataFrame。
- bool
如果兩個對象中的所有元素都相同,則為 True,否則為 False。
參數:
返回:
例子:
>>> import cudf
將係列與
equals
進行比較:>>> s = cudf.Series([1, 2, 3]) >>> other = cudf.Series([1, 2, 3]) >>> s.equals(other) True >>> different = cudf.Series([1.5, 2, 3]) >>> s.equals(different) False
將 DataFrame 與
equals
進行比較:>>> df = cudf.DataFrame({1: [10], 2: [20]}) >>> df 1 2 0 10 20 >>> exactly_equal = cudf.DataFrame({1: [10], 2: [20]}) >>> exactly_equal 1 2 0 10 20 >>> df.equals(exactly_equal) True
要讓兩個 DataFrame 比較相等,列值的類型必須相等,但列標簽的類型不需要:
>>> different_column_type = cudf.DataFrame({1.0: [10], 2.0: [20]}) >>> different_column_type 1.0 2.0 0 10 20 >>> df.equals(different_column_type) True
相關用法
- Python cudf.Series.eq用法及代碼示例
- Python cudf.Series.empty用法及代碼示例
- Python cudf.Series.explode用法及代碼示例
- Python cudf.Series.exp用法及代碼示例
- Python cudf.Series.ceil用法及代碼示例
- Python cudf.Series.update用法及代碼示例
- Python cudf.Series.max用法及代碼示例
- Python cudf.Series.head用法及代碼示例
- Python cudf.Series.reindex用法及代碼示例
- Python cudf.Series.interleave_columns用法及代碼示例
- Python cudf.Series.min用法及代碼示例
- Python cudf.Series.nlargest用法及代碼示例
- Python cudf.Series.to_frame用法及代碼示例
- Python cudf.Series.mask用法及代碼示例
- Python cudf.Series.notnull用法及代碼示例
- Python cudf.Series.isnull用法及代碼示例
- Python cudf.Series.rmod用法及代碼示例
- Python cudf.Series.map用法及代碼示例
- Python cudf.Series.nsmallest用法及代碼示例
- Python cudf.Series.data用法及代碼示例
注:本文由純淨天空篩選整理自rapids.ai大神的英文原創作品 cudf.Series.equals。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。