Polars plugin for pairwise distance functions
Project description
Hellooo :)
This plugin is a work-in progress, main goal is to provide distance metrics on list, arrays and string datatypes.
The docs can be found here: https://ion-elgreco.github.io/polars-distance/
Examples
import polars
import polars_distance as pld
df = pl.DataFrame({
"foo":"hello",
"bar":"hella world"
})
df.select(
pld.col("foo").dist_str.hamming('bar').alias('dist')
)
┌──────┐
│ dist │
│ --- │
│ u32 │
╞══════╡
│ 7 │
└──────┘
df.select(
pld.col('foo').dist_str.levenshtein('bar').alias('dist')
)
┌──────┐
│ dist │
│ --- │
│ u32 │
╞══════╡
│ 6 │
└──────┘
df = pl.DataFrame(
{
"arr": [[1, 2, 10]],
"arr2": [[2, 5, 9]],
},
schema={
"arr": pl.Array(inner=pl.Float64, width=3),
"arr2": pl.Array(inner=pl.Float64, width=3),
},
)
df.select(pld.col('arr').dist_arr.euclidean('arr2').alias('dist'))
shape: (1, 1)
┌──────────┐
│ dist │
│ --- │
│ f64 │
╞══════════╡
│ 3.316625 │
└──────────┘
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_distance-0.4.2.tar.gz
(22.5 kB
view hashes)
Built Distributions
Close
Hashes for polars_distance-0.4.2-cp38-abi3-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a2e62c4fb902a90100f6e13b1e3dae46fe8f76467491a036923722b2806b75fc |
|
MD5 | f7e12e40582b21fab4f2e2714882bffa |
|
BLAKE2b-256 | 0a554519de2dc08d8ae60412796bbdd35d39ca12e470e0e6b20605a2fecf8498 |
Close
Hashes for polars_distance-0.4.2-cp38-abi3-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 22d90e1f25d812c2e77d7b6c3be0f116d8b4536e6e9c27efdef3b181dfeda400 |
|
MD5 | d3ae6c1e26f870b51dd9b0dba1f79065 |
|
BLAKE2b-256 | a2257325bb4f7789ae7e9b6b400728b9c06e6c02e799bd407c53896160ab7040 |
Close
Hashes for polars_distance-0.4.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d8f8699d6de8c2d7696a2438bfab148e8a164b43f082998b90bac020ae771e33 |
|
MD5 | 0598d7ff8b3e735a5db2feeb6891ed80 |
|
BLAKE2b-256 | 967208f123bb9b0140ab6e5b9c516893380e45a68f92ebc8d03cec8245fe5e85 |
Close
Hashes for polars_distance-0.4.2-cp38-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a5de66ba5c7e68b7be48ad5020484c3c18c5e8a57ea40e3336e600c1ecdd89ae |
|
MD5 | d6f665476ee32b24d9a8d2b371ec568a |
|
BLAKE2b-256 | 9ca30afe03eb89c23c87499ab487dbf0d678690f841503fd94736f14e1514370 |
Close
Hashes for polars_distance-0.4.2-cp38-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6522788ee2eee8cb2908c284071a643a08edae331828ce21718c70aa3d9dbf82 |
|
MD5 | 82b4ce7050bf46068adb8b01b298954d |
|
BLAKE2b-256 | 022f100db01aa72c336735acf946d2d4cd20ec5230fdff3d5973572cd6c88a93 |
Close
Hashes for polars_distance-0.4.2-cp38-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cb4c4c3902034cbf224b33e76be78613a092d55680b8b2e07455199fc91157b2 |
|
MD5 | 51e2832dec7bb812fbccd7327d0e1596 |
|
BLAKE2b-256 | c944107fa60e00ba226e31d630aaa9664fe918e0d10fb41a853f1ea58f9b0725 |
Close
Hashes for polars_distance-0.4.2-cp38-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 928a8a0b9e9fb88b65854a1313e39577bfb7c49534129a159605543f6fcb8e75 |
|
MD5 | f4e1dd27df89b6422a8f8b7982e61c2e |
|
BLAKE2b-256 | 97a5ef95078887ab0807d3e38bf0ce9bacf26b949d4b09ad9c60a72a7178d1a5 |
Close
Hashes for polars_distance-0.4.2-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 57fff10d29306b27343f5ad1fca1c0bf49ab7590662cb52ea7c4751682bf10c5 |
|
MD5 | a72ac8eb618a4aeef049495caabe605a |
|
BLAKE2b-256 | da4f04e5a1612019193a867453b09ff63410a00261873758e91fd908bf33e8fd |
Close
Hashes for polars_distance-0.4.2-cp38-abi3-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 35ccec1a5e7c2a97513a62183825307fe131ae608b853db72c9c10abea048386 |
|
MD5 | 6fd03680cc18365e79b5bb80ab244a32 |
|
BLAKE2b-256 | 0c478d6fd9a8673ee6368a589ba257c9ff5c47a3cf43631a82c6e7f686fef67b |
Close
Hashes for polars_distance-0.4.2-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 170a7cb7731e5e270092c40293e026c114ac684ba2b8aedcd7d89826ed257a68 |
|
MD5 | a722dc0050caa1b3f57341e7ce5c76e7 |
|
BLAKE2b-256 | c05815a2e96ed5ecffc6eee5fd1522aec6e157b667656222cd50e558a639e672 |