pyspark.sql.functions.bitwise_not

pyspark.sql.functions.bitwise_not(col: ColumnOrName) → pyspark.sql.column.Column[source]

Computes bitwise not.

New in version 3.2.0.

Changed in version 3.4.0: Supports Spark Connect.

Parameters
colColumn or str

target column to compute on.

Returns
Column

the column for computed results.

Examples

>>> df = spark.range(1)
>>> df.select(bitwise_not(lit(0))).show()
+---+
| ~0|
+---+
| -1|
+---+
>>> df.select(bitwise_not(lit(1))).show()
+---+
| ~1|
+---+
| -2|
+---+