pyspark.sql.functions.degrees#
- pyspark.sql.functions.degrees(col)[source]#
Converts an angle measured in radians to an approximately equivalent angle measured in degrees.
New in version 2.1.0.
Changed in version 3.4.0: Supports Spark Connect.
- Parameters
- col
Column
or column name angle in radians
- col
- Returns
Column
angle in degrees, as if computed by java.lang.Math.toDegrees()
Examples
>>> from pyspark.sql import functions as sf >>> spark.sql( ... "SELECT * FROM VALUES (0.0), (PI()), (PI() / 2), (PI() / 4) AS TAB(value)" ... ).select("*", sf.degrees("value")).show() +------------------+--------------+ | value|DEGREES(value)| +------------------+--------------+ | 0.0| 0.0| | 3.141592653589...| 180.0| |1.5707963267948...| 90.0| |0.7853981633974...| 45.0| +------------------+--------------+