Skip to main content

List-oriented math and expression helpers for Polars.

Project description

polars-list-math

polars-list-math is a Python/Rust package with list-oriented expression helpers for Polars.

Import the package once to register extra methods on Expr.list:

import polars as pl
import polars_list_math  # noqa: F401

Install

pip install polars-list-math
# or
uv add polars-list-math

Requires Python 3.12+ and polars>=1.39.3.

Methods

Method Result Docs
Expr.list.zip(...) Zip lists into list[struct] Polars proposal
Expr.list.combinations(...) Pair each item with itself and later items in the same list Combinations
Expr.list.combinations_to(...) Pair each item with each item from another list Combinations
Expr.list.similarity(...) Weighted similarity between two lists Similarity
Expr.list.mean_similarity(...) Mean similarity inside a nested-list row Similarity
Expr.list.mean_similarity_to(...) Mean similarity to reference nested lists Similarity

The Python helper py_list_similarity(...) computes the same weighted similarity for plain Python sequences.

If a future Polars release ships native methods with the same names, this package leaves the native implementation untouched.

Quick Examples

df = pl.DataFrame(
    {
        "a": [[1, 2, 3]],
        "b": [[2, 1, 3]],
        "groups": [[[1, 2, 3], [1, 2, 3], [4, 5, 6]]],
    }
)

df.with_columns(
    pl.col("a").list.similarity("b").alias("similarity"),
    pl.col("groups").list.mean_similarity().alias("mean_similarity"),
    pl.col("a").list.combinations().alias("pairs"),
    pl.col("a").list.zip("b", fields=["a", "b"]).alias("zipped"),
)

Development

make install
make develop
make test

Build and check the package locally:

make check-dist

Release steps are in docs/publishing.md.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

polars_list_math-0.1.1.tar.gz (32.7 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

polars_list_math-0.1.1-cp313-cp313-win_amd64.whl (4.8 MB view details)

Uploaded CPython 3.13Windows x86-64

polars_list_math-0.1.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.2 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

polars_list_math-0.1.1-cp313-cp313-macosx_11_0_arm64.whl (4.4 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

polars_list_math-0.1.1-cp313-cp313-macosx_10_12_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

polars_list_math-0.1.1-cp312-cp312-win_amd64.whl (4.8 MB view details)

Uploaded CPython 3.12Windows x86-64

polars_list_math-0.1.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.2 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

polars_list_math-0.1.1-cp312-cp312-macosx_11_0_arm64.whl (4.4 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

polars_list_math-0.1.1-cp312-cp312-macosx_10_12_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

File details

Details for the file polars_list_math-0.1.1.tar.gz.

File metadata

  • Download URL: polars_list_math-0.1.1.tar.gz
  • Upload date:
  • Size: 32.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for polars_list_math-0.1.1.tar.gz
Algorithm Hash digest
SHA256 1dd10ffc8650e041a3ea22583b04dc43ded4d944881718e4b0baafb097ecf4bb
MD5 1f11020556f0ce48274405605878944b
BLAKE2b-256 e2c32fc0af1cb58383b4a2fcb270ee1065c894e452d82e955e831e6e66ceade7

See more details on using hashes here.

Provenance

The following attestation bundles were made for polars_list_math-0.1.1.tar.gz:

Publisher: publish.yml on rufrozen/polars-list-math

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file polars_list_math-0.1.1-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for polars_list_math-0.1.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 c0d90c599a6ae00eb622ecf5397d92b5da6013f17ad72b5101ea0fc5b90631f8
MD5 e82d65619bc84b2db385c2b9011c59ab
BLAKE2b-256 c508925895c63ea1aeaa908954187a9339fedf28285166c23902abf3c72154eb

See more details on using hashes here.

Provenance

The following attestation bundles were made for polars_list_math-0.1.1-cp313-cp313-win_amd64.whl:

Publisher: publish.yml on rufrozen/polars-list-math

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file polars_list_math-0.1.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for polars_list_math-0.1.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c19b36583fbecbafac1fda813ebebccd75665096919d90d44f8d0185f15d96f4
MD5 5bcdb4f911e9d3deb4c680118d37add1
BLAKE2b-256 d8a195691ea1dcbcce26f4d674c24111a7755a374516c6b02fe135f027ecfbf8

See more details on using hashes here.

Provenance

The following attestation bundles were made for polars_list_math-0.1.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: publish.yml on rufrozen/polars-list-math

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file polars_list_math-0.1.1-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for polars_list_math-0.1.1-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 59b291b99a4e55661bf377dcfe5a488ecd3319f7c532f116f8f59c9771fd84fe
MD5 effa4bf9994e49458ce5124b5a4e1964
BLAKE2b-256 1fb6aba35724a14d2cf88c8b60e7587a535d70d627fafe338389ce979c0b9a0c

See more details on using hashes here.

Provenance

The following attestation bundles were made for polars_list_math-0.1.1-cp313-cp313-macosx_11_0_arm64.whl:

Publisher: publish.yml on rufrozen/polars-list-math

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file polars_list_math-0.1.1-cp313-cp313-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for polars_list_math-0.1.1-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 776497f6341630f4b0dc0dd590db8bf5f4bf424333d7f5a6c433e372ebb6f11a
MD5 6b1b0e30f36685281e49c9bd6dd1ccf6
BLAKE2b-256 e2940bd2172938df44269cfd44297c7d04a0d381516cc473346de4912003ca0f

See more details on using hashes here.

Provenance

The following attestation bundles were made for polars_list_math-0.1.1-cp313-cp313-macosx_10_12_x86_64.whl:

Publisher: publish.yml on rufrozen/polars-list-math

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file polars_list_math-0.1.1-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for polars_list_math-0.1.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 a970a09b1e457456b7ab7ad4eec38b81dd30ee219580d3da575a885aaef9d857
MD5 2c8f52a9d018bc2f059647025574a0dd
BLAKE2b-256 0bc525eebfe2bcb4e2a832934d37f3b508f9a4ca757982d8dd60b516655e4249

See more details on using hashes here.

Provenance

The following attestation bundles were made for polars_list_math-0.1.1-cp312-cp312-win_amd64.whl:

Publisher: publish.yml on rufrozen/polars-list-math

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file polars_list_math-0.1.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for polars_list_math-0.1.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f9dd52383a2a398bc769a1fa1d6e57d09ecf2648e05b60a5f1f2424fd88d1d3a
MD5 d2c47613ec3f67d57a8e6f08fc522f4e
BLAKE2b-256 a5e6da7c741adf9a22c4ed303448808fd5460e58b783d25982fdca063e023b8f

See more details on using hashes here.

Provenance

The following attestation bundles were made for polars_list_math-0.1.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: publish.yml on rufrozen/polars-list-math

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file polars_list_math-0.1.1-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for polars_list_math-0.1.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 28c9eaddf5599f34c749736a1d56cc7ab31255ffabd90d9d118f0c6018eeeb9d
MD5 d39c2fec20aff40e0910c9d87acb5378
BLAKE2b-256 8a729529100e23d236af324ca2b376d19e9dfb40e52cacb6de874f6c0aa607ba

See more details on using hashes here.

Provenance

The following attestation bundles were made for polars_list_math-0.1.1-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: publish.yml on rufrozen/polars-list-math

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file polars_list_math-0.1.1-cp312-cp312-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for polars_list_math-0.1.1-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 475e57281f94eaa9f7b76341096c0b59adeebb558be6c9ddc260ed13caa9d1f8
MD5 9cfd9cf77b4fa70cff82d5aaf61c388b
BLAKE2b-256 f4fb790420f32768ce8a63624ee6d73a4622a0bc4384ecd6759cc3f78fcedefe

See more details on using hashes here.

Provenance

The following attestation bundles were made for polars_list_math-0.1.1-cp312-cp312-macosx_10_12_x86_64.whl:

Publisher: publish.yml on rufrozen/polars-list-math

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page