Skip to main content

High-performance DataFrame unifying DuckDB (out-of-core) and Pandas (ML feature engineering)

Project description

HybridFrame

A high-performance dual-engine DataFrame that transparently shifts between DuckDB (lazy/out-of-core) and Pandas (materialised/in-memory).

Installation

pip install hybrid-frame

With optional dependencies:

pip install hybrid-frame[arrow]       # zero-copy Arrow materialisation
pip install hybrid-frame[memory-guard] # psutil-based OOM protection
pip install hybrid-frame[ml]           # scikit-learn for ML export
pip install hybrid-frame[all]          # everything

Quick Start

from hybrid_frame import HybridFrame
import pandas as pd

# Wrap an existing DataFrame
hf = HybridFrame.from_pandas(pd.DataFrame({"x": [1, 2, 3], "y": [4, 5, 6]}))

# Lazy DuckDB operations — zero Pandas copies
hf.filter("x > 1").sort_values("y", ascending=False)

# Chain into Pandas for ML feature engineering
result = hf.assign(x2=lambda df: df["x"] * 2).to_pandas()

# Stream a CSV lazily from disk
hf = HybridFrame.from_csv("large_file.csv")
print(hf.filter("age > 21").shape)

Features

  • Zero-copy engine transitions — stays in Pandas mode for simple operations (head/tail/select/rename/drop), auto-transitions to DuckDB for complex SQL operations (filter/sort/groupby/join)
  • Lazy DuckDB connections — no connection overhead until DuckDB is actually needed
  • Out-of-core streamingfetch_chunked(), to_pandas_iter(), to_arrow_reader() for memory-efficient processing
  • ML-ready exportto_ml_ready(target_column) returns (X, y) tuple
  • File I/Ofrom_csv(), from_parquet(), write_csv(), write_parquet()
  • Set operationsunion, intersect, except_
  • Cumulative operationsdiff, cumsum, cumprod, cummin, cummax
  • Value imputationfillna, dropna, replace, clip, time_series_impute
  • DuckDB SQL passthroughsql("SELECT ... FROM self WHERE ...")
  • Memory guard — automatic OOM protection for large materialisations

Documentation

Full API reference is available in the class docstrings. Run help(HybridFrame) or visit GitHub.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hybrid_frame-0.3.1.tar.gz (23.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hybrid_frame-0.3.1-py3-none-any.whl (22.3 kB view details)

Uploaded Python 3

File details

Details for the file hybrid_frame-0.3.1.tar.gz.

File metadata

  • Download URL: hybrid_frame-0.3.1.tar.gz
  • Upload date:
  • Size: 23.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for hybrid_frame-0.3.1.tar.gz
Algorithm Hash digest
SHA256 88441e7134cbdd88a067395a7bbba1cf4aa3c78ce85d01c9974b917997b7ef8c
MD5 4c000dbf8eca5d1d33ee7bede05c2cbe
BLAKE2b-256 a991a77b9e8d9cd84f6fae7555f53bddc612b94b4f8247920557258c1ea32f47

See more details on using hashes here.

File details

Details for the file hybrid_frame-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: hybrid_frame-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 22.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for hybrid_frame-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 00d0d9a99ed0d299ddbe75d35308313dcbd68ff4a5b74494e1eb2fa6aee26f94
MD5 ff890d95c3bce2bb3f248612abcef5a2
BLAKE2b-256 d80000151e8d868dfa0cb27d8cf2073d3dde0f5f3f7a6dafc651cba0974c7aed

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page