pyspark.sql.functions.
pmod
Returns the positive value of dividend mod divisor.
New in version 3.4.0.
Changed in version 3.4.0: Supports Spark Connect.
Column
the column that contains dividend, or the specified dividend value
the column that contains divisor, or the specified divisor value
positive value of dividend mod divisor.
Examples
>>> from pyspark.sql.functions import pmod >>> df = spark.createDataFrame([ ... (1.0, float('nan')), (float('nan'), 2.0), (10.0, 3.0), ... (float('nan'), float('nan')), (-3.0, 4.0), (-10.0, 3.0), ... (-5.0, -6.0), (7.0, -8.0), (1.0, 2.0)], ... ("a", "b")) >>> df.select(pmod("a", "b")).show() +----------+ |pmod(a, b)| +----------+ | NaN| | NaN| | 1.0| | NaN| | 1.0| | 2.0| | -5.0| | 7.0| | 1.0| +----------+