datafusion-extra-functions (mode, skewness, kurtosis, max_by, min_by) for datafusion-python, via the DataFusion FFI PyCapsule protocol
Project Links
Meta
Requires Python: >=3.10
Classifiers
Programming Language
- Python :: 3
- Python :: 3.10
- Python :: 3.11
- Python :: 3.12
- Python :: 3.13
- Rust
License
- OSI Approved :: Apache Software License
datafusion-extra-functions (Python)
Python wheels for datafusion-extra-functions, exposing each aggregate through datafusion-python's __datafusion_aggregate_udf__ PyCapsule protocol.
Usage
from datafusion import SessionContext, col, udaf
import datafusion_extra_functions as extra
extra.list_functions()
# ['mode', 'max_by', 'min_by', 'kurtosis', 'skewness', 'kurtosis_pop']
skew = udaf(extra.udaf_by_name("skewness"))
ctx = SessionContext()
df = ctx.from_pydict({"a": [1.0, 2.0, 2.0, 9.0]})
df.aggregate([], [skew(col("a"))]).show()
Or register for SQL:
ctx.register_udaf(udaf(extra.udaf_by_name("mode")))
ctx.sql("SELECT mode(a) FROM my_table").show()
Version compatibility
The DataFusion FFI ABI is tied to the datafusion major version this package was compiled against. The wheel pins datafusion>=55,<56. A mismatch fails at the FFI boundary rather than with a clean error.
Building from source
From this python/ directory, with a Rust toolchain (see rust-version in Cargo.toml):
pip install maturin
maturin develop --release
License
Apache-2.0, same as the crate it binds.
Wheel compatibility matrix
| Platform | CPython >=3.10 (abi3) |
|---|---|
| macosx_10_12_x86_64 | |
| macosx_11_0_arm64 | |
| manylinux2014_aarch64 | |
| manylinux2014_x86_64 | |
| manylinux_2_17_aarch64 | |
| manylinux_2_17_x86_64 | |
| win_amd64 |
Files in release
datafusion_extra_functions-0.5.5-cp310-abi3-macosx_10_12_x86_64.whl (4.6MiB)
datafusion_extra_functions-0.5.5-cp310-abi3-macosx_11_0_arm64.whl (4.3MiB)
datafusion_extra_functions-0.5.5-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (4.7MiB)
datafusion_extra_functions-0.5.5-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (6.3MiB)
datafusion_extra_functions-0.5.5-cp310-abi3-win_amd64.whl (4.9MiB)
datafusion_extra_functions-0.5.5.tar.gz (54.8KiB)
Extras:
None
Dependencies:
datafusion
(<56,>=55)