pyspark.sql.functions.bitwise_not#
- pyspark.sql.functions.bitwise_not(col)[source]#
Computes bitwise not.
New in version 3.2.0.
Changed in version 3.4.0: Supports Spark Connect.
- Parameters
- col
Column
or column name target column to compute on.
- col
- Returns
Column
the column for computed results.
Examples
>>> from pyspark.sql import functions as sf >>> spark.sql( ... "SELECT * FROM VALUES (0), (1), (2), (3), (NULL) AS TAB(value)" ... ).select("*", sf.bitwise_not("value")).show() +-----+------+ |value|~value| +-----+------+ | 0| -1| | 1| -2| | 2| -3| | 3| -4| | NULL| NULL| +-----+------+