Registry / data / polars-hash

polars-hash

JSON →
library0.6.0pypypi✓ verified 86d ago

A Python library providing stable non-cryptographic and cryptographic hashing functions for Polars DataFrames. Version 0.5.6 supports algorithms like xxhash, murmurhash3, farmhash, SHA3 SHAKE128, UUID5, and H3 spatial index. It integrates directly into Polars expressions via `hash_` prefix. Maintained, with frequent releases.

pip install polars-hash
INSTALL
IMPORT
SIG · POLARS-HASH
P
polars-hash
datapythonv0.6.0
Install
3.6s avg
Import
410ms
Disk
237MB
Pass rate
5/ 10
Env Coverage5 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.6.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
build_error
glibc
py 3.103.95 runs
installs and imports cleanly · install 3.6s · import 0.410s · 252MB
237MB installed
● package 237MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

hash_xxh3
import polars_hash
No direct import of hash functions; use `polars_hash.hash_xxh3(...)`.
hash_murmurhash3
import polars_hash
Access via `polars_hash.hash_murmurhash3(...)`.
hash_farmhash
import polars_hash
Access via `polars_hash.hash_farmhash(...)`.

Create a Polars DataFrame and add XXH3 and MurmurHash3 hash columns.

import polars as pl import polars_hash df = pl.DataFrame({'text': ['hello', 'world']}) df_with_hash = df.with_columns( polars_hash.hash_xxh3('text').alias('hash_xxh3'), polars_hash.hash_murmurhash3('text').alias('hash_murmur') ) print(df_with_hash)
Debug
Known issues
breakingVersion 0.5.0 bumped Polars dependency to >=1.32.0. Older code using Polars <1.32.0 will fail to import.
fix
Upgrade Polars to >=1.32.0, or pin polars-hash to <0.5.0.
affects: >=0.5.0
deprecatedPrior to 0.4.9, the library used `polars.type_aliases` which is deprecated. Old custom serialisation or alias-dependent code may break.
fix
Upgrade to >=0.4.9 and remove any use of `polars.type_aliases`.
affects: <0.4.9
gotchaHash functions return columns of type `UInt64` for non-cryptographic hashes and `Utf8` for cryptographic/special hashes (e.g., UUID5, SHA3). Mixing may cause type errors in expressions.
fix
Cast results explicitly: `.cast(pl.UInt64)` or `.cast(pl.Utf8)` as needed.
affects: all
gotchaThe `hash_uuid5` function requires a namespace UUID as first argument; omitting it will raise a `TypeError`.
fix
Provide a valid namespace: `polars_hash.hash_uuid5('namespace_uuid', 'text')`.
affects: >=0.5.6
Errors
Common errors & fixes
AttributeError: module 'polars_hash' has no attribute 'hash_xxh3'
Older version of polars-hash does not include xxh3 (added in 0.5.2).
fix
Upgrade to >=0.5.2: `pip install polars-hash>=0.5.2`.
ImportError: cannot import name 'hash_xxh3' from 'polars_hash'
Trying to import individual functions incorrectly. The library does not export function names at package level.
fix
Use `polars_hash.hash_xxh3(...)` directly without importing the function. Correct usage: `import polars_hash; polars_hash.hash_xxh3(...)`.
TypeError: hash_uuid5() missing 1 required positional argument: 'namespace_uuid'
hash_uuid5 requires a namespace UUID as first argument.
fix
Provide a UUID string: `polars_hash.hash_uuid5('6ba7b810-9dad-11d1-80b4-00c04fd430c8', 'text')`.
Upgrade
Version history
0.6.0latest on PyPI · released May 30, 2026
Audit
Dependencies
polarsrequiredCore dependency; library provides Polars expressions.
Agent activity
6 hits · last 30 days
node
6
Resources
polars-hash — pip install polars-hash · libregistry