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.3

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.3
File Size Uploaded
ga_gataframe-0.1.3.tar.gz 70.2 kB Details

Built distribution (wheel)

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

Total release size: 114.2 kB

Release files / ga_gataframe-0.1.3.tar.gz

Download URL ga_gataframe-0.1.3.tar.gz
Size 70.2 kB
Tags Source
SHA-256 checksum
How to use checksums
e103a18c668a49e88203e697b0279008f6d852f3c241863c47139191a2a6f9da
BLAKE2b-256 checksum
How to use checksums
2fa826e7d419fceacb0eb27240bad19c8c33417338fea1d2f938c4c95c032a4e
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 8, 2026.

Transparency log

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

Download URL ga_gataframe-0.1.3-py3-none-any.whl
Size 44.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
987a9ea02563831eb8e2422eca6c49bfba4169d95b225543c1dc1c7ef90774eb
BLAKE2b-256 checksum
How to use checksums
b9eeb9ae9cc087bfc18b95a3caaf8a4eb35d0837e889e3f78289cbfae66e0373
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 8, 2026.

Transparency log

Release history Release notifications | RSS feed

0.1.5

2 release files

0.1.4

2 release files

This release

0.1.3 This release

2 release files

0.1.1

2 release files

0.1.0

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