polars.Expr.arccos#

Expr.arccos() Expr[source]#

Compute the element-wise value for the inverse cosine.

engine:In MemoryStreamingDistributed
Returns:
Expr

Expression of data type Float64, measuring an angle in radians.

Notes

To convert the result from radians to degrees, call .degrees().

Examples

>>> df = pl.DataFrame({"a": [1.0, 0.5, 0]})
>>> df.select(pl.col("a").arccos())
shape: (3, 1)
┌──────────┐
│ a        │
│ ---      │
│ f64      │
╞══════════╡
│ 0.0      │
│ 1.047198 │
│ 1.570796 │
└──────────┘
>>> df.select(pl.col("a").arccos().degrees())
shape: (3, 1)
┌──────┐
│ a    │
│ ---  │
│ f64  │
╞══════╡
│ 0.0  │
│ 60.0 │
│ 90.0 │
└──────┘