Metadata-Version: 2.5
Name: duckpd
Version: 0.0.2
Summary: A lazy pandas-shaped DataFrame powered by DuckDB
Project-URL: Homepage, https://github.com/quantbert/duckpd
Project-URL: Repository, https://github.com/quantbert/duckpd
Project-URL: Issues, https://github.com/quantbert/duckpd/issues
Project-URL: Changelog, https://github.com/quantbert/duckpd/blob/main/docs/CHANGELOG.md
Author: QuantBert
License: MIT License
        
        Copyright (c) 2026 QuantBert
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Database
Classifier: Topic :: Scientific/Engineering
Classifier: Typing :: Typed
Requires-Python: >=3.11
Requires-Dist: duckdb<1.6,>=1.5
Requires-Dist: pandas<3.1,>=3.0
Requires-Dist: pyarrow>=18
Description-Content-Type: text/markdown

# duckpd

DuckPD is an experimental lazy DataFrame library with a pandas-shaped frontend
and DuckDB as its execution engine.

> [!WARNING]
> **DuckPD is a work in progress and is not yet recommended for
> production-critical workloads.** The API and supported pandas semantics may
> change between `0.x` releases, and many pandas operations are intentionally
> unsupported. Validate results and resource behavior for each intended
> workload before adopting it.

DuckPD intentionally supports a small, explicit subset of pandas rather than
silently falling back to materializing a complete pandas DataFrame. See the
[release policy](docs/RELEASES.md) for the pre-`1.0` stability policy.

## Current capabilities

- Lazy pandas, Arrow, Parquet, DuckDB table, and read-only SQL sources.
- Column selection, boolean filtering, arithmetic expressions, `assign`,
  `sort_values`, and `limit`.
- Eager DataFrame and Series `count`, `size`, `sum`, `mean`, `min`, and `max`
	reductions over numeric and boolean data, including `skipna`, `min_count`,
	and DataFrame `numeric_only` support.
- Explicit lazy indexes with `set_index()`/`reset_index()` and source
	`index=`/`order_by=` declarations.
- Explicit pandas collection, bounded `head`, Arrow tables and record batches,
  physical plan inspection, and direct Parquet writes.
- Session-level memory, spill-directory, temporary-size, and thread settings.
- Rejection of ambiguous cross-frame alignment and mutating SQL.

## Example

```python
import duckpd as pd

orders = pd.read_parquet("orders/*.parquet")

result = (
    orders[orders["status"] == "paid"]
    .assign(net=lambda frame: frame["amount"] - frame["refund_amount"])
    .sort_values("net", ascending=False)[["order_id", "net"]]
    .limit(100)
)

print(result.explain())
preview = result.head(10)
result.write_parquet("largest-paid-orders.parquet")
pandas_result = result.collect()
```

Transformations above are lazy. `explain()`, `head()`, `collect()`, Arrow output,
and file output are explicit execution boundaries. `limit()` stays lazy while
`head()` returns a bounded pandas preview.

## Demos

Small runnable programs are available in [demo/](demo/README.md):

```bash
uv run python demo/basic_pipeline.py
uv run python demo/parquet_pipeline.py
uv run python demo/reduction_pipeline.py
uv run python demo/generate_market_data.py
uv run python demo/market_data_demo.py
```

See the [benchmark results](docs/BENCHMARK.md) for performance and memory
comparisons between DuckPD and pandas across 100 MB, 1 GB, and 5 GB datasets.

## Development

```bash
uv sync --frozen --group dev
make check
make build
```

GNU Make is optional. The equivalent commands are:

```bash
uv run pytest
uv run ruff check .
uv run ruff format --check .
uv run pyright
uv build
```

See the [documentation index](docs/README.md) for the implementation roadmap,
architecture decisions, benchmarks, research, and changelog.