Skip to content

sens_slope

Source: src/sens_slope.rs

Sen's slope estimator for Polars Series.

The Theil-Sen estimator computes the median of all pairwise slopes (x[j] - x[i]) / (j - i) for i < j, providing a robust measure of trend magnitude that is resistant to outliers.

Python API

sens_slope

sens_slope(...)

Compute Sen's slope (median of pairwise slopes) for the first Series in inputs.

Parameters

Parameter Description
inputs a slice of Series, with the first entry expected to be a float Series (f64).

Returns

A single-valued Float64 Series containing the Sen's slope estimate.

Errors

Returns an error if the first Series is not of f64 type or if it contains nulls.