Nota
Capaian ke halaman ini memerlukan kebenaran. Anda boleh cuba mendaftar masuk atau menukar direktori.
Capaian ke halaman ini memerlukan kebenaran. Anda boleh cuba menukar direktori.
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|
+-----+----+----------+