Polars Fuzzy Matching
Installation
pip install polars
pip install polars-fuzzy-match
Usage
With both the plugin and polars installed, usage is as follows:
import polars as pl
from polars_fuzzy_match import fuzzy_match_score
df = pl.DataFrame(
{
'strs': ['foo', 'foo quz BAR', 'baaarfoo', 'quz'],
}
)
pattern = 'bar'
out = df.with_columns(
score=fuzzy_match_score(
pl.col('strs'),
pattern,
)
)
print(out)
This outputs:
shape: (4, 2)
┌─────────────┬───────┐
│ strs ┆ score │
│ --- ┆ --- │
│ str ┆ u32 │
╞═════════════╪═══════╡
│ foo ┆ null │
│ foo quz BAR ┆ 88 │
│ baaarfoo ┆ 74 │
│ quz ┆ null │
└─────────────┴───────┘
When there is no match, score is null. When the pattern matches the value in
the given column, score is non-null. The higher the score, the closer the value
is to the pattern. Therefore, we can filter out values that do not match and
order by score:
pattern = 'bar'
out = (
df.with_columns(
score=fuzzy_match_score(
pl.col('strs'),
pattern,
)
)
.filter(pl.col('score').is_not_null())
.sort(by='score', descending=True)
)
print(out)
This outputs:
shape: (2, 2)
┌─────────────┬───────┐
│ strs ┆ score │
│ --- ┆ --- │
│ str ┆ u32 │
╞═════════════╪═══════╡
│ foo quz BAR ┆ 88 │
│ baaarfoo ┆ 74 │
└─────────────┴───────┘
Fzf-style search syntax
This plugin supports Fzf-style search syntax for the pattern. It's worth noting that this section is taken almost verbatim from the Fzf README:
| Pattern | Match type | Description |
|---|---|---|
bar |
fuzzy | items that fuzzy match bar e.g. 'bXXaXXr' |
'foo |
substring exact match | items that include foo e.g. 'is foo ok' |
^music |
prefix exact match | items that start with music |
.mp3$ |
suffix exact match | items that end with .mp3 |
!fire |
inverse exact match | items that do not include fire |
!^music |
inverse prefix exact match | items that do not start with music |
!.mp3$ |
inverse suffix exact match | items that do not end with .mp3 |
Credits
- Marco Gorelli's Tutorial on writing Polars Plugin. See here.
- The Helix Editor team for the Nucleo fuzzy matching library.
Metadata
Release files for polars-fuzzy-match 0.1.5
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 | Actions |
|---|---|---|---|---|
| polars_fuzzy_match-0.1.5.tar.gz | 18.7 kB | Without provenance | Details for polars_fuzzy_match-0.1.5.tar.gz |
Built distributions (wheels)
Total release size: 25.3 MB
Release files / polars_fuzzy_match-0.1.5.tar.gz
| Download URL | polars_fuzzy_match-0.1.5.tar.gz |
|---|---|
| Size | 18.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0826613117e424a44eff7ce74b02655b570704fbbe4cb796fe93b9f45353a89d
|
|
BLAKE2b-256 checksum How to use checksums |
ea29d1526913208ba7d6ed295271ac4a226ab72770ba4ad96a066949eb24510a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.7.0
|
Release files / polars_fuzzy_match-0.1.5-cp38-abi3-win_amd64.whl
| Download URL | polars_fuzzy_match-0.1.5-cp38-abi3-win_amd64.whl |
|---|---|
| Size | 2.8 MB |
| Tags | CPython 3.8 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
66aba4f763ee1ce2fefe42d995b6dad9b77de1e7407319edcb3a787fdc32e0f1
|
|
BLAKE2b-256 checksum How to use checksums |
838962716219ff87b6e9431b4d85479a9190b82db27e9f284ca304e1016a0d1f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.7.0
|
Release files / polars_fuzzy_match-0.1.5-cp38-abi3-win32.whl
| Download URL | polars_fuzzy_match-0.1.5-cp38-abi3-win32.whl |
|---|---|
| Size | 2.4 MB |
| Tags | CPython 3.8 Windows x86-32 abi3 |
|
SHA-256 checksum How to use checksums |
a824a07d13458508b39388ae4f69377f6d2113f4ecf0062bf799d07ca242d66b
|
|
BLAKE2b-256 checksum How to use checksums |
66482a602b4be4eb860fd275ec918af26cb08fdfdb145a15cba32bef8d45764b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.7.0
|
Release files / polars_fuzzy_match-0.1.5-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | polars_fuzzy_match-0.1.5-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 3.5 MB |
| Tags | CPython 3.8 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
586f58cef000a53e1e74d8483156c145496aab67605f68f9f44a3f9b5a68413c
|
|
BLAKE2b-256 checksum How to use checksums |
c243816669882f93959cad67bf855bdde993935b68fbfe8d2c2790f3569b596b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.7.0
|
Release files / polars_fuzzy_match-0.1.5-cp38-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
| Download URL | polars_fuzzy_match-0.1.5-cp38-abi3-manylinux_2_17_i686.manylinux2014_i686.whl |
|---|---|
| Size | 3.7 MB |
| Tags | CPython 3.8 Linux glibc 2.17+ x86-32 abi3 |
|
SHA-256 checksum How to use checksums |
8f3d4b79885e09f62e0260a04fc87addf957cb4ec6a8b31c5fc48b20887dc5a5
|
|
BLAKE2b-256 checksum How to use checksums |
68ca8e741ccbbbc4644db5304bd59f1d6718ace3b208d0edd5c19b6a2c601ff4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.7.0
|
Release files / polars_fuzzy_match-0.1.5-cp38-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
| Download URL | polars_fuzzy_match-0.1.5-cp38-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl |
|---|---|
| Size | 3.5 MB |
| Tags | CPython 3.8 Linux glibc 2.17+ ARMv7l abi3 |
|
SHA-256 checksum How to use checksums |
5f07cc4b62c4030861209f759336426e36a5ffc19df3e98ca9aa10ceeac55393
|
|
BLAKE2b-256 checksum How to use checksums |
e1fec31cde16311072d7a23bc0751416fb56865f5885f9ae9780656fb8b09bd8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.7.0
|
Release files / polars_fuzzy_match-0.1.5-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | polars_fuzzy_match-0.1.5-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 3.4 MB |
| Tags | CPython 3.8 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
d7abc7774d5baa67d9bf829063a09d26f0c45bd2e859def7d9035e2ab67aca8d
|
|
BLAKE2b-256 checksum How to use checksums |
c59a9fa1847fbe0ebddccb20e4758ec21a68cd6b98686f0969dfdb493345509f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.7.0
|
Release files / polars_fuzzy_match-0.1.5-cp38-abi3-macosx_11_0_arm64.whl
| Download URL | polars_fuzzy_match-0.1.5-cp38-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 2.9 MB |
| Tags | CPython 3.8 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
b0052f3c10137b8610fec52edeca2edd4aa76654150cab589f31aec6ca6d3b22
|
|
BLAKE2b-256 checksum How to use checksums |
173718de858e81a34df13395dd038f2b03f48804966022689124fcaeafb6b8d3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.7.0
|
Release files / polars_fuzzy_match-0.1.5-cp38-abi3-macosx_10_12_x86_64.whl
| Download URL | polars_fuzzy_match-0.1.5-cp38-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 3.2 MB |
| Tags | CPython 3.8 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
35666f26403341149da8f8804cd0af8cbb7202ec809c2af49fa09d922eba7281
|
|
BLAKE2b-256 checksum How to use checksums |
49774b63bd50bf2a15123d2cf2524be6d88ff3686456d207d540b6f264b8598d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.7.0
|
Security for polars-fuzzy-match 0.1.5
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.