Skip to main content

GataFrame

CI PyPI Python

GataFrame is a lightweight Python library built around DuckDB relations. It adds a dataframe-style wrapper plus file and database read-write helpers for tabular and geospatial workflows.

The PyPI distribution is named ga-gataframe; the import package is named gataframe.

Installation

python -m pip install ga-gataframe

Development and test tools are available as extras:

python -m pip install -e ".[test]"
python -m pip install -e ".[dev]"

Optional parallel cleanup helpers are available with:

python -m pip install -e ".[parallel]"

Quick Start

import pandas as pd

from gataframe import connect

engine = connect(extensions=None)

gf = engine.read(pd.DataFrame({"id": [1, 2], "value": [10, 20]}))
result = gf.withColumn("double_value", "value * 2").filter("double_value > 20").toPandas()

assert result["double_value"].tolist() == [40]

engine.close()

GataFrame

GataFrame wraps a duckdb.DuckDBPyRelation and keeps operations chainable. Most methods return a new GataFrame unless inplace=True is passed.

import pandas as pd

from gataframe import connect

engine = connect(extensions=None)
gf = engine.read(pd.DataFrame({"a": [1, 2], "b": [3, 4]}))

out = (
    gf.withColumn("total", "a + b")
    .renameColumn("total", "sum_ab")
    .replaceColumn("sum_ab", "sum_ab * 10")
    .select("a", "sum_ab")
)

assert out.columns == ["a", "sum_ab"]

Common methods include:

  • withColumn(name, expression) and replaceColumn(name, expression)
  • renameColumn(old, new) and excludeColumn(*columns)
  • select(*columns), filter(expression), and limit(n)
  • createTable(...), createView(...), dropTable(...), and dropView(...)
  • toPandas(), toGeoPandas(...), and toPandasOrGeoPandas(...)

Engine

Engine owns the DuckDB connection and handles input/output.

from gataframe import connect

engine = connect(extensions=None, file_based=False)

gf = engine.read("data.csv", header=True)
engine.write(gf, "out.parquet", mode="overwrite")

engine.close()

Supported readers and writers are inferred from file extensions where possible: CSV, JSON, Parquet, GeoParquet, GeoJSON, GeoPackage, Shapefile, SQLite, and PostgreSQL connection URLs.

DuckDB extensions are loaded only when requested by the caller or needed by a specific geospatial/database operation.

API Summary

  • connect(logger=None, extensions=None, options=None, file_based=False, file=None)
  • read(engine, source, format=None, pre_limit=None, limit=None, ...)
  • write(engine, df, destination, mode="overwrite", partitionBy=None, ...)
  • Engine.connect(...)
  • Engine.read(source, format=None, ...)
  • Engine.write(df, destination, mode="overwrite", ...)
  • GataFrame.withColumn(...), replaceColumn(...), renameColumn(...)
  • GataFrame.select(...), filter(...), limit(...), union(...)
  • GataFrame.toPandas(), toGeoPandas(...), and toPandasOrGeoPandas(...)

Development

GataFrame supports Python 3.10 and newer.

python -m pip install -e ".[dev]"
python -m compileall -q src
python -m pytest --cov=gataframe --cov-report=term-missing
ruff format --check .
ruff check .
mypy
python -m pip check
python -m build
python -m twine check dist/*

GitHub Repository Setup

This project is prepared for the future repository andreagemma/gataframe.

  1. Create the empty repository on GitHub.
  2. Initialize the local repository if needed and push the project to main.
  3. Confirm the CI workflow passes on GitHub.
  4. Configure the PyPI Trusted Publisher for project ga-gataframe, owner andreagemma, repository gataframe, workflow release.yml, and environment pypi.

Releases

src/gataframe/_version.py is the only version source. To publish a release:

  1. Update __version__ in _version.py and commit the release changes.
  2. Push main and wait for CI to pass.
  3. Run the Create release GitHub Actions workflow. With no override it creates the v<version> tag, creates release notes, and dispatches the build and PyPI publication workflow.

PyPI versions are immutable. Increment _version.py before publishing different content.

License

GataFrame is distributed under the MIT License. See LICENSE.

Release files for ga-gataframe 0.1.0

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

Source distribution (sdist)

Source distribution for ga-gataframe 0.1.0
File Size Uploaded
ga_gataframe-0.1.0.tar.gz 43.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ga-gataframe 0.1.0
File Interpreter ABI Platform
ga_gataframe-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 87.4 kB

Release files / ga_gataframe-0.1.0.tar.gz

Download URL ga_gataframe-0.1.0.tar.gz
Size 43.5 kB
Tags Source
SHA-256 checksum
How to use checksums
b71d494be39241d0c48182fbc378bf1a786c0c8822ee5b32ba92f8cb3d33a515
BLAKE2b-256 checksum
How to use checksums
f052cf087cba2465c79058fbeaefd74244ae17e3683577094efd7e06fa789937
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 Sep 2, 2026.

Transparency log

Release files / ga_gataframe-0.1.0-py3-none-any.whl

Download URL ga_gataframe-0.1.0-py3-none-any.whl
Size 43.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
76d830b6c1d29da7ed22cf2928cd3ae32a08f4a29bf013344c6882c22878c153
BLAKE2b-256 checksum
How to use checksums
73955f163c068c60ddc65343aff6ec63563f00098c2e689118d1850012963408
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 Sep 2, 2026.

Transparency log

Release history Release notifications | RSS feed

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.1

2 release files

This release

0.1.0 This release

2 release files

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