Skip to main content

numbarrow

Numba adapters for PyArrow and PySpark.

numbarrow lets you work with Apache Arrow arrays directly inside Numba @njit compiled functions. It converts PyArrow arrays into NumPy views (zero-copy where possible) and extracts validity bitmaps for null handling — bridging PySpark's Arrow-based batch processing with high-performance JIT-compiled code.

Installation

pip install numbarrow

Optional dependencies for PySpark and pandas support:

pip install numbarrow[test]       # adds pyspark
pip install numbarrow[mapinarrow] # adds pandas

Quick Start

import pyarrow as pa
from numba import njit
from numbarrow.core.adapters import arrow_array_adapter
from numbarrow.core.is_null import is_null

# Convert a PyArrow array to NumPy for use in @njit
arrow_array = pa.array([10, None, 30, 40], type=pa.int32())
bitmap, data = arrow_array_adapter(arrow_array)

@njit
def sum_non_null(data, bitmap):
    total = 0
    for i in range(len(data)):
        if bitmap is None or not is_null(i, bitmap):
            total += data[i]
    return total

result = sum_non_null(data, bitmap)  # 80

Supported Types

PyArrow Type NumPy Result Copy?
Int32Array, Int64Array, DoubleArray Matching dtype No (view)
BooleanArray bool_ Yes (bit-unpacking)
Date32Array datetime64[D] Yes (int32 → int64)
Date64Array datetime64[ms] No (view)
TimestampArray datetime64[unit] No (view)
StringArray Fixed-width Unicode (bitmaps, data) Yes (repacking)
StructArray Tuple of two dicts: (bitmaps, data) per field Per-field
ListArray (of structs) Tuple of two dicts: (bitmaps, data) per field Per-field

PySpark Integration

Use make_mapinarrow_func to create functions compatible with PySpark's mapInArrow:

from numbarrow.core.mapinarrow_factory import make_mapinarrow_func

def compute(data_dict, bitmap_dict, broadcasts):
    # data_dict: {col_name: np.ndarray}
    # bitmap_dict: {col_name: uint8 bitmap array}
    result = data_dict["value"] * broadcasts["scale"]
    return {"output": result}

udf = make_mapinarrow_func(compute, broadcasts={"scale": 2.0})
df_out = df_in.mapInArrow(udf, output_schema)

See test/demo_map_in_arrow.py for a complete runnable example.

Compatibility

Dependency Versions
Python 3.10 – 3.12
numba 0.60 – 0.63
pyarrow 14 – 18
pyspark 3.3 – 3.x (optional)
pandas 1.5+ (optional)

Documentation

Full API documentation: numbarrow docs

License

See LICENSE.

Release files for numbarrow 0.3.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for numbarrow 0.3.2
File Interpreter ABI Platform
numbarrow-0.3.2-py3-none-any.whl Python 3 none any Details

Release files / numbarrow-0.3.2-py3-none-any.whl

Download URL numbarrow-0.3.2-py3-none-any.whl
Size 13.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8c935e139c1bda260312e5770fd9ff38e2a794f9d3b03e700f17c29c140e3d2e
BLAKE2b-256 checksum
How to use checksums
71dd3a5ddb228762ed635b28b45e0092637e89cffb73326c82d251aaac1b0c84
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 28, 2026.

Transparency log

Release history Release notifications | RSS feed

0.3.5

1 release file

0.3.4

1 release file

0.3.3

1 release file

This release

0.3.2 This release

1 release file

0.3.1

1 release file

0.2.1

1 release file

0.2.0

1 release file

0.1.3

1 release file

0.1.2

1 release file

0.1.1

1 release file

0.1.0

1 release file

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page