degrees
Converts an angle measured in radians to an approximately equivalent angle measured in degrees. Supports Spark Connect.
For the corresponding Databricks SQL function, see degrees function.
Syntax
Python
from pyspark.databricks.sql import functions as dbf
dbf.degrees(col=<col>)
Parameters
Parameter | Type | Description |
|---|---|---|
|
| angle in radians |
Returns
pyspark.sql.Column: angle in degrees, as if computed by java.lang.Math.toDegrees()
Examples
Python
from pyspark.databricks.sql import functions as dbf
spark.sql("SELECT * FROM VALUES (0.0), (PI()), (PI() / 2), (PI() / 4) AS TAB(value)").select("*", dbf.degrees("value")).show()
Output
+------------------+--------------+
| value|DEGREES(value)|
+------------------+--------------+
| 0.0| 0.0|
| 3.141592653589...| 180.0|
|1.5707963267948...| 90.0|
|0.7853981633974...| 45.0|
+------------------+--------------+