pyspark.sql.functions.nullifzero#
- pyspark.sql.functions.nullifzero(col)[source]#
Returns null if col is equal to zero, or col otherwise.
New in version 4.0.0.
- Parameters
- col
Column
or str
- col
Examples
>>> df = spark.createDataFrame([(0,), (1,)], ["a"]) >>> df.select(nullifzero(df.a).alias("result")).show() +------+ |result| +------+ | NULL| | 1| +------+