Introducing The Sweep: OX’s New Live Security Research Series
Register Now
Breaking: The 2026 Vulnpocalypse Hits PHP: Four Critical RCEs, but How Dangerous Are They?
Read the Report
Are you exposed? Connect your apps in minutes.
Scan your apps free

polars-list-math

Latest version: v1.2.0

Overview

Last scanned
29 Nov 2026
Published
29 Nov 2026
PyPI package Publisher: rufrozen
1 Stars
0 Forks
8 Versions
1.1K Downloads
Python Repo language

Scan summary

polars-list-math was last scanned on 29 Nov 2026 at version 1.2.0. Risk score 0 of 100. No malicious behavior was detected.

  • Releases: 8 versions; the latest 4 were published on 29 Nov 2026.
  • Findings: No rules fired in version 1.2.0.
  • Downloads: 1,085 downloads.

Versions

8 versions published
Versions and the rules that fired in each
VersionPublishedStatus
1.2.0 LATEST 29 Nov 2026 No rules fired
0.11.0 29 Nov 2026 No rules fired
1.1.0 29 Nov 2026 No rules fired
0.10.0 29 Nov 2026 Not shown
0.9.1 6 Nov 2026 Not shown

No rules fired in 1.2.0

Findings

Findings for v1.2.0. The score is a capped sum of the weights of the rules that fired — not CVSS, not exploitability, and not a probability. It is not comparable across packages with different scan coverage.

The score describes 1.2.0; other versions have their own rules, not their own score.

README

The publisher’s own README, as collected from the registry.

polars-list-math

polars-list-math helps you work with Polars DataFrames in which every field of a nested list of structs is represented by its own column. Each field column preserves the original list nesting, so corresponding values remain aligned by row and by position at every list level.

For example, a nested list of records with price and qty fields can be represented as two nested list columns in the same DataFrame:

flowchart LR
    records["orders: List[List[Struct]]<br/>[[{price: 10, qty: 2}, {price: 20, qty: 1}],<br/>[{price: 30, qty: 4}]]"]
    subgraph columns["Separate field columns — same DataFrame row"]
        price["orders.price: List[List[Int64]]<br/>[[10, 20], [30]]"]
        qty["orders.qty: List[List[Int64]]<br/>[[2, 1], [4]]"]
    end
    records -->|price| price
    records -->|qty| qty

Each level of lists keeps its grouping, and each field becomes independently accessible as a column. The same representation extends to deeper nesting. The dotted column names above are illustrative.

The library provides Python/Rust helpers for calculations on these list columns, comparing lists, and combining corresponding fields with list_zip and ZipBuilder. It also includes JSON and URL expressions, null-field discovery, and schema cleaning for preparing and transforming DataFrames and LazyFrames.

Release notes and upgrade guidance are recorded in CHANGELOG.md.

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

import polars as pl
import polars_list_math  # noqa: F401

For type-checked code, import the top-level expression helpers described below.

Install

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

Requires Python 3.12+ and polars>=2.2.0,<3.

Version 1.0 targets Polars 2 and includes a compatible Rust plugin. Upgrade polars-list-math and polars together; rebuild the plugin when using a source checkout. Projects using Polars 1 should keep polars-list-math==0.9.0 and polars<2. See the Polars 2 migration guide for changes in Polars itself.

The native p-value aggregation needs no SciPy. For the Python reference or its fallback, install polars-list-math[scipy].

Functions

Top-level functions provide the statically typed API for Pyright, Pylance, and other type checkers. Where available, the optional Method column lists an equivalent runtime method registered when the package is imported.

Function Method (optional) Result Docs
pvalue(values, control_values) — Two-sided paired t-test p-value P-value
py_pvalue(values, control_values) — Optional SciPy reference for Python sequences P-value
bootstrap_confidence(...) — Bootstrap interval for mean, sum, or nearest median Bootstrap confidence
bootstrap_ratio_confidence(...) — Paired bootstrap percentile interval for a ratio of sums Bootstrap confidence
list_zip(...) Expr.list.zip(...) Zip lists into list[struct] List zip
nested_join(...) — Attach flat values using nested and ancestor keys Nested join
nested_lookup(...) — Look up a shared or row-local dictionary, preserving List structure Nested join
list_combinations(...) Expr.list.combinations(...) Pair items in one list Combinations
list_combinations_to(...) Expr.list.combinations_to(...) Pair items from two lists Combinations
expected_value_of_game(...) — Expected value of a sequential game Expected value of a game
list_similarity(...) Expr.list.similarity(...) Weighted similarity between two lists Similarity
list_mean_similarity(...) Expr.list.mean_similarity(...) Mean similarity inside nested lists Similarity
list_mean_similarity_to(...) Expr.list.mean_similarity_to(...) Mean similarity to reference nested lists Similarity
list_kendall_tau(...) Expr.list.kendall_tau(...) Kendall tau of the common IDs' order Kendall tau
list_mean_kendall_tau(...) Expr.list.mean_kendall_tau(...) Mean tau against peer lists Kendall tau
list_mean_kendall_tau_to(...) Expr.list.mean_kendall_tau_to(...) Mean tau against reference lists Kendall tau
list_containment(...) Expr.list.containment(...) Fraction of unique IDs found in another list Containment
list_mean_containment(...) Expr.list.mean_containment(...) Mean directed containment against peer lists Containment
list_mean_containment_to(...) Expr.list.mean_containment_to(...) Mean directed containment against reference lists Containment
json_object_items(expr, strict=False) Expr.str.json_object_items(...) Convert a JSON object to list[struct[key, value]] JSON object items
json_array_values(expr, strict=False) Expr.str.json_array_values(...) Convert a JSON array to list[str] JSON array values
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
dfs_to_lazy_df(...) — Expose DataFrame batches as a pushdown-aware LazyFrame source Examples
find_null_schema(lf) — Discover absent columns and nested fields Null schemas
clean_schema(schema, subschema) — Remove columns and fields described by a subschema Null schemas
apply_schema(lf, schema) — Select and cast a LazyFrame to the cleaned schema Null schemas

The Python helper py_list_similarity(...) computes weighted similarity for plain Python sequences. py_list_containment(...) computes directed set containment for Python sequences, ignoring ranks and duplicates. py_list_kendall_tau(...) compares the order of common IDs in Python sequences. All Kendall tau helpers accept normalize=True to map [-1, 1] to [0, 1].

The Expr.list and Expr.str methods are registered dynamically and remain available as convenient runtime syntax. Python type checkers cannot safely augment Polars' own namespace classes from another installed package, so use the equivalent top-level functions in code checked by Pylance or Pyright.

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

Quick Examples

from polars_list_math import (
    list_combinations,
    list_mean_similarity,
    list_similarity,
    list_zip,
)

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

df.with_columns(
    list_similarity("a", "b").alias("similarity"),
    list_mean_similarity("groups").alias("mean_similarity"),
    list_combinations("a").alias("pairs"),
    list_zip("a", "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.

from polars_list_math import json_array_values, json_object_items

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

json_df.select(
    json_object_items("object").alias("items"),
    json_array_values("array").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.

Nested zip builder

ZipBuilder combines nested list columns with zip options and ordered eval/filter operations at each level. build() returns a normal Polars expression:

from polars_list_math import ZipBuilder

expr = (
    ZipBuilder("a", "b")
    .level(pad=True)
    .filter(pl.element().struct.field("a").is_not_null())
    .build("nested_zip")
)

The constructor configures the outer zip; each level() adds one inner zip. See the builder guide for transformations, broadcasting, and deeper nesting.

Performance experiments

Reproducible performance experiments live in the performance directory. Each experiment has its own README with the tested scenario, run instructions, environment, and recorded results.

The current dataframe_construction experiment compares construction of 30-column Polars DataFrames from a regular dataclass, a slotted dataclass, and a named tuple, including nested structs and lists.

uv run pytest performance/dataframe_construction -v -s

Development

make install
make develop
make test

Build and check the package locally:

make check-dist

Release steps are in docs/publishing.md.

OX Radar and Response Center

Find threats in your stack.

OX Radar can check high-priority threats, like critical package CVEs, against your context.

Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.

Where it’s listed

The probe returned only these fields for this server — auth requirement, protocol and tool list weren’t observed, so they’re not shown (never guessed).

  • pypi-releases polars-list-math

References

The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.

Powered by Read the latest findings

Scan your whole stack

Group 1261154050 1
Group 1261154050
 

From OX Research Newsroom

Copy of Template Design OX Blog (3)
Research

Ruby2Shell: Ruby Memory Corruption Flaws Expose Applications to Remote Code Execution, But is it an Actual Risk?

Plug and Pray: Your AI Agents Are Taking Orders From Strangers
Research

Plug and Pray: Your AI Agents Are Taking Orders From Strangers

Microsoft's Official agent framework Hijacked
AI & VibeSec

BREAKING: Hijacked Releases of Microsoft’s Official agent-framework Steals Azure and CI Credentials

Frame 2085668439 (1)
Group 1261154229