pyspark.sql.functions.cos#

pyspark.sql.functions.cos(col)[source]#

Computes cosine of the input column.

New in version 1.4.0.

Changed in version 3.4.0: Supports Spark Connect.

Parameters
colColumn or str

angle in radians

Returns
Column

cosine of the angle, as if computed by java.lang.Math.cos().

Examples

>>> from pyspark.sql import functions as sf
>>> spark.range(1).select(sf.cos(sf.pi())).show()
+---------+
|COS(PI())|
+---------+
|     -1.0|
+---------+