A polars expression plugin for splines
Project description
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)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
polars_splines-0.1.1.tar.gz
(13.6 kB
view hashes)
Built Distribution
Close
Hashes for polars_splines-0.1.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 74399541429480c6a4ebb6f812e06959020ed54ca55ba47101ce7ec90eb313cf |
|
MD5 | 2bcab549e082d556a5caa4d12727d518 |
|
BLAKE2b-256 | 273cd397b2e1a074b674e46bdbf23a0fa3044a2922e915d653deda862075629f |