polars-splines 0.1.1

Creator: railscoder56

Last updated:

Add to Cart

Description:

polarssplines 0.1.1

Polars splines
An simple extension plugin for py-polars, that interfaces with the Rust cargo splines, for spline interpolation.
Usage
The expression plugin adds splines to the expression namespace. This contains the method spline which acts on a Series of Struct type. The two fields corresponds to the (x, y) pairs to be interpolated. The spline method accepts a keyword argument xi for the interpolation points.
For example,
import polars as pl
import polars_splines
import numpy as np

x = pl.Series("x", np.linspace(0, 1, 100))
y = pl.Series("y", np.sin(x))

df = pl.DataFrame({"x": x, "y": y})

xi = pl.Series("xi", np.linspace(0, 1, 1000))

dfi = df.select(
pl.struct("x", "y").splines.spline(list(xi), fill_value=0.0).alias("yi")
).with_columns(xi)

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Customer Reviews

There are no reviews.