Graph solving and grouping extension for Polars DataFrames
Project description
PolarsGrouper
PolarsGrouper is a Rust-based extension for Polars that efficiently groups connected components in dataframes for graph analysis.
Features
- Group connected components in dataframes.
- High performance using Rust and Polars.
- Works with both eager and lazy Polars DataFrames.
Installation
To install PolarsGrouper, use pip
:
pip install polars-grouper
# Create a virtual environment
python -m venv .venv
source .venv/bin/activate
# Build and install using maturin
maturin develop
Usage
graph_solver Register the graph_solver function:
import polars as pl
from polars_grouper import graph_solver
df = pl.DataFrame({
"from": ["A", "B", "C"],
"to": ["B", "C", "D"]
})
result_df = df.with_columns(
graph_solver(pl.col("from"), pl.col("to")).alias("group")
)
print(result_df)
Super_merger
Use super_merger to add connected component group information to a dataframe:
from polars_grouper import super_merger
import polars as pl
df = pl.LazyFrame({
"from": ["A", "B", "C"],
"to": ["B", "C", "D"]
})
result_df = super_merger(df, "from", "to")
print(result_df.collect())
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_grouper-0.1.0.tar.gz
(19.4 kB
view hashes)
Built Distributions
Close
Hashes for polars_grouper-0.1.0-cp38-abi3-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b8a136bd4162a59e629729c52da3d5716b50e3f222060111d459994ef1a24dd4 |
|
MD5 | 92c794cebbe560528cc2030a85ef5445 |
|
BLAKE2b-256 | ecfb5f8514f8ba71c75e556eac6b7e0a6bb79f42c256dc843ead3128552dc789 |
Close
Hashes for polars_grouper-0.1.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6d161c1a894dfc13b38296338c4d8bef68a2d825e4ca2f7b4d8a141e3cd16ea9 |
|
MD5 | 4e6873c2f9841ed04ea5ce111af95de5 |
|
BLAKE2b-256 | 899784df24d01e402ff6e50f8af18c264ce2b57dae8ac3edaf27a76632c39a9f |
Close
Hashes for polars_grouper-0.1.0-cp38-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ccc77a58ce36d05dbd39cfe704e5847bff5326c0dd881c689db1c18fbc8a4d8d |
|
MD5 | b033a7407fa79f8b994cf6b50a6c90d2 |
|
BLAKE2b-256 | 6249f3e69f8f048a37b5179fbecc6de88eeeee03d44138ce7bdc991379381009 |
Close
Hashes for polars_grouper-0.1.0-cp38-abi3-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6cd203ec061628a83d612545cc585edbeb1f3dfd5023067fd65fab4a3b356f9a |
|
MD5 | 8c7a962ecb02cbb608b03a3704fe4b12 |
|
BLAKE2b-256 | 8a0a3d26414e614953bc83ce2527acc516bf0609fc220a377b6491123a6e01da |
Close
Hashes for polars_grouper-0.1.0-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9fd40daf2b870c029e757624b4ff182593bb719995f7b443bfe6dd401251c29b |
|
MD5 | 5fe1d2a07012ba4be748a3f2a06b47a9 |
|
BLAKE2b-256 | 9363adcbaf361100186651b0039dcb460582fb8ef69dba2dd3de05ef152d1234 |