Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Returns the positive value of dividend mod divisor. Supports Spark Connect.
For the corresponding Databricks SQL function, see pmod function.
Syntax
from pyspark.databricks.sql import functions as dbf
dbf.pmod(dividend=<dividend>, divisor=<divisor>)
Parameters
| Parameter | Type | Description |
|---|---|---|
dividend |
pyspark.sql.Column, column name or float |
the column that contains dividend, or the specified dividend value |
divisor |
pyspark.sql.Column, column name or float |
the column that contains divisor, or the specified divisor value |
Returns
pyspark.sql.Column: positive value of dividend mod divisor.
Examples
from pyspark.databricks.sql import functions as dbf
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("*", dbf.pmod("a", "b")).show()
+-----+----+----------+
| a| b|pmod(a, b)|
+-----+----+----------+
| 1.0| NaN| NaN|
| NaN| 2.0| NaN|
| 10.0| 3.0| 1.0|
| NaN| NaN| NaN|
| -3.0| 4.0| 1.0|
|-10.0| 3.0| 2.0|
| -5.0|-6.0| -5.0|
| 7.0|-8.0| 7.0|
| 1.0| 2.0| 1.0|
+-----+----+----------+