Polars Loess
This is a loess local regression (locally estimated scatterplot smoothing) implementation in Rust for Polars.
This is an early release. There is room for improvement in terms of performance, memory efficiency and feature set. I value feedback from the community to see where to go next.
Installation
pip install polars-loess
API
loess(
'x-column', # Name of the existing x-values
'y-column', # Name of the existing y-values
'new-x-column', # Name of the new x values. y-values are interpolated for these x-values using loess
# Optional float to specify the fraction of the data used in each local regression.
# Exactly one of frac or points must be specified.
frac=None,
# Optional integer to specify the number of points used in each local regression.
# Exactly one of frac or points must be specified.
points=None,
# Optional integer to specify the degree of the polynomial used in each local regression.
# Default is 1.
degree=None,
)
Example
import polars as pl
from polars_loess import loess
df = pl.DataFrame({
'time': [
0.5578196, 2.0217271, 2.5773252, 3.4140288, 4.3014084,
4.7448394, 5.1073781, 6.5411662, 6.7216176, 7.2600583,
8.1335874, 9.1224379, 11.9296663, 12.3797674, 13.2728619,
14.2767453, 15.3731026, 15.6476637, 18.5605355, 18.5866354
],
'price': [
18.63654, 103.49646, 150.35391, 190.51031, 208.70115,
213.71135, 228.49353, 233.55387, 234.55054, 223.89225,
227.68339, 223.91982, 168.01999, 164.95750, 152.61107,
160.78742, 168.55567, 152.42658, 221.70702, 222.69040,
],
})
result = df.with_columns(loess = loess('time', 'price', 'time', frac=0.5))
print(result)
Another example can be found in run.py. The result looks like.
Acknowledgements
- The loess implementation is based on https://github.com/joaofig/loess-rs
- The Python bindings are based on https://marcogorelli.github.io/polars-plugins-tutorial/
Metadata
Release files for polars-loess 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| polars_loess-0.1.1.tar.gz | 209.6 kB | Without provenance | Details |
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| polars_loess-0.1.1-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.8 | abi3 | Linux glibc 2.17+ x86-64 | Details |
| polars_loess-0.1.1-cp38-abi3-macosx_11_0_arm64.whl | CPython 3.8 | abi3 | macOS 11.0+ ARM64 | Details |
Total release size: 7.3 MB
Release files / polars_loess-0.1.1.tar.gz
| Download URL | polars_loess-0.1.1.tar.gz |
|---|---|
| Size | 209.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
36be59dd253e0764827dc813d5fef7b52a09c14ec4764e7bbc45732b2d634475
|
|
BLAKE2b-256 checksum How to use checksums |
052aef7f8601878d88af75186cfa125e1cd59ddb3837cb95727468cbe4f2bd73
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.7.1
|
Release files / polars_loess-0.1.1-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | polars_loess-0.1.1-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 3.9 MB |
| Tags | CPython 3.8 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
3d5648bbeab1bc4112a7bb85d6d6c49d8b19935ac0f6ed6f0232e0b000546961
|
|
BLAKE2b-256 checksum How to use checksums |
071ec3c26d9369ec8145da2f33478683fcc2cb829263ee6c517a7f3fe3deb66c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.7.1
|
Release files / polars_loess-0.1.1-cp38-abi3-macosx_11_0_arm64.whl
| Download URL | polars_loess-0.1.1-cp38-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 3.2 MB |
| Tags | CPython 3.8 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
89e7d8e225414c3d8a01b8174204d54905522463211caab35b6ac7d73a1f0748
|
|
BLAKE2b-256 checksum How to use checksums |
7ce70baedf5563dd3cfe846b66626728b7004e89c97534d08aa9a7994c029a08
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.7.1
|
Security for polars-loess 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.