pyspark.sql.functions.cos¶
-
pyspark.sql.functions.
cos
(col: ColumnOrName) → pyspark.sql.column.Column[source]¶ Computes cosine of the input column.
New in version 1.4.0.
Changed in version 3.4.0: Supports Spark Connect.
- Parameters
- col
Column
or str angle in radians
- col
- Returns
Column
cosine of the angle, as if computed by java.lang.Math.cos().
Examples
>>> import math >>> df = spark.range(1) >>> df.select(cos(lit(math.pi))).first() Row(COS(3.14159...)=-1.0)