หมายเหตุ
การเข้าถึงหน้านี้ต้องได้รับการอนุญาต คุณสามารถลอง ลงชื่อเข้าใช้หรือเปลี่ยนไดเรกทอรีได้
การเข้าถึงหน้านี้ต้องได้รับการอนุญาต คุณสามารถลองเปลี่ยนไดเรกทอรีได้
Returns the bitwise XOR of all non-null input values, or null if none.
Syntax
from pyspark.sql import functions as sf
sf.bit_xor(col)
Parameters
| Parameter | Type | Description |
|---|---|---|
col |
pyspark.sql.Column or column name |
Target column to compute on. |
Returns
pyspark.sql.Column: the bitwise XOR of all non-null input values, or null if none.
Examples
Example 1: Bitwise XOR with all non-null values
from pyspark.sql import functions as sf
df = spark.createDataFrame([[1],[1],[2]], ["c"])
df.select(sf.bit_xor("c")).show()
+----------+
|bit_xor(c)|
+----------+
| 2|
+----------+
Example 2: Bitwise XOR with some null values
from pyspark.sql import functions as sf
df = spark.createDataFrame([[1],[None],[2]], ["c"])
df.select(sf.bit_xor("c")).show()
+----------+
|bit_xor(c)|
+----------+
| 3|
+----------+