Skip to main content

polars-list-math

polars-list-math is a Python/Rust package with list, JSON, and URL expression helpers for Polars.

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

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 items in one list, optionally skipping self-pairs 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
Expr.str.json_object_items(...) Convert a JSON object to list[struct[key, value]] JSON object items
Expr.str.json_array_values(...) Convert a JSON array to list[str] JSON array values

Top-level expression helpers:

Function Result Docs
url_query_encode(expr, doseq=False) Encode a Struct or key/value list as a URL query string URL query encoding
url_build(...) Assemble a URL from optional component expressions URL building

The package also exports json_object_items(expr) and json_array_values(expr) as top-level equivalents of the Expr.str methods. The Python helper py_list_similarity(...) computes 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"),
)

Convert JSON strings to nested Polars values. String values stay strings, JSON null stays null, and other values become compact JSON strings. Invalid JSON returns null by default; pass strict=True to raise instead.

json_df = pl.DataFrame(
    {
        "object": ['{"name":"Ada","active":true,"note":null}'],
        "array": ['["python",42,true,null]'],
    }
)

json_df.select(
    pl.col("object").str.json_object_items().alias("items"),
    pl.col("array").str.json_array_values().alias("values"),
)

Encode query parameters and build URLs from expressions:

from polars_list_math import url_build, url_query_encode

pages = pl.DataFrame(
    {
        "host": ["example.com"],
        "path": ["/search"],
        "term": ["rust polars"],
        "page": [2],
    }
)

query = url_query_encode(pl.struct(q=pl.col("term"), page=pl.col("page")))

pages.select(
    url_build(
        scheme=pl.lit("https"),
        netloc="host",
        path="path",
        query=query,
    ).alias("url")
)

More complete, runnable examples are available in the examples directory.

Development

make install
make develop
make test

Build and check the package locally:

make check-dist

Release steps are in docs/publishing.md.

Metadata

Release files for polars-list-math 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for polars-list-math 0.1.2
File Size Uploaded Provenance
polars_list_math-0.1.2.tar.gz 37.8 kB With provenance Details

Built distributions (wheels)

Table of built distributions (wheels) for polars-list-math 0.1.2
File
polars_list_math-0.1.2-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details
polars_list_math-0.1.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.17+ x86-64 Details
polars_list_math-0.1.2-cp313-cp313-macosx_11_0_arm64.whl CPython 3.13 CPython 3.13 macOS 11.0+ ARM64 Details
polars_list_math-0.1.2-cp313-cp313-macosx_10_12_x86_64.whl CPython 3.13 CPython 3.13 macOS 10.12+ x86-64 Details
polars_list_math-0.1.2-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details
polars_list_math-0.1.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.17+ x86-64 Details
polars_list_math-0.1.2-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details
polars_list_math-0.1.2-cp312-cp312-macosx_10_12_x86_64.whl CPython 3.12 CPython 3.12 macOS 10.12+ x86-64 Details

Total release size: 38.8 MB

Release files / polars_list_math-0.1.2.tar.gz

Download URL polars_list_math-0.1.2.tar.gz
Size 37.8 kB
Tags Source
SHA-256 checksum
How to use checksums
29c2006ae019f9181dc1e0c4563825772554fb562b6f94e0f7605ae967722b0c
BLAKE2b-256 checksum
How to use checksums
51db459702abdcb2ba17c49d9257910b18c19b6714821908b30002a43cb60097
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 4, 2026.

Transparency log

Release files / polars_list_math-0.1.2-cp313-cp313-win_amd64.whl

Download URL polars_list_math-0.1.2-cp313-cp313-win_amd64.whl
Size 4.9 MB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
306047d7b17ef5f2b70d9ec4189e00cdfbd07f7a7b61dd5295871d250a034dee
BLAKE2b-256 checksum
How to use checksums
28c2ef3c76183588c7082568e071fdec5c6f0a8d3f27d46bb7ae35911a6197f8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 4, 2026.

Transparency log

Release files / polars_list_math-0.1.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL polars_list_math-0.1.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 5.2 MB
Tags CPython 3.13 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
1e01e0c09466242e3e7d6c33bd40bd90c9af7b049d7cff7e7fc034618b0f3107
BLAKE2b-256 checksum
How to use checksums
c49da5611fe94763843b2101b5f425469ca35ea7e0572a5c1c5f47d9622d5a45
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 4, 2026.

Transparency log

Release files / polars_list_math-0.1.2-cp313-cp313-macosx_11_0_arm64.whl

Download URL polars_list_math-0.1.2-cp313-cp313-macosx_11_0_arm64.whl
Size 4.5 MB
Tags CPython 3.13 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
596a39f76789548c9fb6004281385f4365377e2a6e7679af1f36a02f884ddcca
BLAKE2b-256 checksum
How to use checksums
ccfabd2bbe4dcf58cdce9e6bf1787b8db21fd7a41287cc061e19ec9afbe45088
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 4, 2026.

Transparency log

Release files / polars_list_math-0.1.2-cp313-cp313-macosx_10_12_x86_64.whl

Download URL polars_list_math-0.1.2-cp313-cp313-macosx_10_12_x86_64.whl
Size 4.8 MB
Tags CPython 3.13 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
710b2fadbbb2fb17f103229bfa4d8f7c80b3e28c145e76b573157e67f6b8ab2f
BLAKE2b-256 checksum
How to use checksums
d0168de84a97e1f9c52f9334eee8d851899bbe3ecc7968c751e2a5db9f1144a3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 4, 2026.

Transparency log

Release files / polars_list_math-0.1.2-cp312-cp312-win_amd64.whl

Download URL polars_list_math-0.1.2-cp312-cp312-win_amd64.whl
Size 4.9 MB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
1fdb6228b934730a9e6878f396d7505a690fcf98a814f6fa80a0a1472c3669ea
BLAKE2b-256 checksum
How to use checksums
d3c5865e5c324597a23553c54c4a4f25d6e87eaec24335f32b0d97b7e35b0251
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 4, 2026.

Transparency log

Release files / polars_list_math-0.1.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL polars_list_math-0.1.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 5.3 MB
Tags CPython 3.12 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
002ae2b92982724a61b5fc20903a0b4b20d48c98d45ccb85fbad0f1c27d51bbd
BLAKE2b-256 checksum
How to use checksums
cebc9add67418a1e2d19542c84abeed03048ec5695b4701414a55b981343a2f9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 4, 2026.

Transparency log

Release files / polars_list_math-0.1.2-cp312-cp312-macosx_11_0_arm64.whl

Download URL polars_list_math-0.1.2-cp312-cp312-macosx_11_0_arm64.whl
Size 4.5 MB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
34468b1648d1116eac656c05f940d32ea0f7c257cf8cd626feb5d5aecff20b64
BLAKE2b-256 checksum
How to use checksums
ae8ab9c1d99e84fc2c221d9f6ce27d8bf69116203c4bcd40d86f15cf3a5a539b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 4, 2026.

Transparency log

Release files / polars_list_math-0.1.2-cp312-cp312-macosx_10_12_x86_64.whl

Download URL polars_list_math-0.1.2-cp312-cp312-macosx_10_12_x86_64.whl
Size 4.8 MB
Tags CPython 3.12 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
bc9e7fdcbf87996fbcde8d85dab2fe27dd51a8cdbbf30cd3bad5026072559869
BLAKE2b-256 checksum
How to use checksums
12d0bb6d167fc848c4089fcf307eb7e5bc699f09de95ac4c8c98cd050ab4dd96
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 4, 2026.

Transparency log

Security for polars-list-math 0.1.2

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.

Full provenance

All 9 files in this release have been uploaded with provenance metadata.

Select from 9 files

Attestation for polars_list_math-0.1.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 4, 2026.

Transparency log

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page