Skip to main content

god — a grammar of data, for Python

One small vocabulary for manipulating tables, spelled the same way in Python, in R, and as plain text. A pipeline is checked whole before any of it runs, so a bad column is reported at the step that names it rather than failing partway through — or worse, not failing.

import pandas as pd
from god import *

sales = pd.read_csv("sales.csv")

sales >> keep(col.region == "West") \
      >> summarize(margin = total(col.margin), by = col.product)

The same sentence runs as plain text, byte-for-byte what you would paste into R or into a database:

run("""
sales
  then keep where [region] is "West"
  then summarize [margin] as total([margin]) by [product]
""")

And when you reach the edge of the vocabulary, it shows you the same pipeline in a tool you already know — show_as(pipeline, "pandas"), or "polars", "pyspark", "dplyr", "sql", "spark".

Installing

The distribution is grammar-of-data and the import is god — the PyPI name god was taken in 2016 by an unrelated package, and a distribution name and an import name are independent. Until the PyPI release lands, install a wheel built from the repository at https://github.com/psychometrician/god, which carries the engine inside it.

What is here

File Owns
god/verbs.py The fourteen verbs. Each builds a sentence and decides nothing
god/columns.py How Python names a column: col.region, and the expressions it grows
god/run.py The text form, finding the engine, and running the query
setup.py Packs the engine into the wheel, and tags the wheel for the platform the engine was built for

Any decision at all lives in the grammar, not here. This package finds a frame, hands over some text, runs the query it gets back, and returns a native frame.

What was checked about Python's operators

  • |> is impossible. It does not tokenize, and Python's operator set is fixed by the grammar. No import hook fakes it, because that breaks the editor support a front end exists to provide.
  • >> is available. Neither pandas nor polars defines __rshift__, so a bare frame falls through to __rrshift__. Verified by running it.
  • | is refused. Both define __or__, and frame | verb never reaches the verb — it does an elementwise or and returns a frame of True. A silent wrong answer is the one outcome this project will not ship.

The manual, live in both languages, is at https://psychometrician.github.io/god-book/.

Release files for grammar-of-data 0.1.0

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

Built distributions (wheels)

Table of built distributions (wheels) for grammar-of-data 0.1.0
File
grammar_of_data-0.1.0-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details
grammar_of_data-0.1.0-py3-none-manylinux_2_28_x86_64.whl Python 3 none Linux glibc 2.28+ x86-64 Details
grammar_of_data-0.1.0-py3-none-manylinux_2_28_aarch64.whl Python 3 none Linux glibc 2.28+ ARM64 Details
grammar_of_data-0.1.0-py3-none-macosx_11_0_arm64.whl Python 3 none macOS 11.0+ ARM64 Details
grammar_of_data-0.1.0-py3-none-macosx_10_12_x86_64.whl Python 3 none macOS 10.12+ x86-64 Details

Total release size: 2.4 MB

Release files / grammar_of_data-0.1.0-py3-none-win_amd64.whl

Download URL grammar_of_data-0.1.0-py3-none-win_amd64.whl
Size 392.7 kB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
75f405793111c5958cd499fc36ca8f740acd7d83116e2b7bf444a62041e78f84
BLAKE2b-256 checksum
How to use checksums
ef630e6768e70834e6687ab5695764d1b537cd9ebf697ca6d06a5d956385311a
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 11, 2026.

Transparency log

Release files / grammar_of_data-0.1.0-py3-none-manylinux_2_28_x86_64.whl

Download URL grammar_of_data-0.1.0-py3-none-manylinux_2_28_x86_64.whl
Size 519.2 kB
Tags Linux glibc 2.28+ x86-64 Python 3
SHA-256 checksum
How to use checksums
2100e7448084103a241a402c0879413a6eb419c50e82817aafc9d78836592912
BLAKE2b-256 checksum
How to use checksums
5b96cabf3ece5341a43f43b97d27b05d35055f1861087034861075a3658da987
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 11, 2026.

Transparency log

Release files / grammar_of_data-0.1.0-py3-none-manylinux_2_28_aarch64.whl

Download URL grammar_of_data-0.1.0-py3-none-manylinux_2_28_aarch64.whl
Size 489.1 kB
Tags Linux glibc 2.28+ ARM64 Python 3
SHA-256 checksum
How to use checksums
f84a222575f01c44ee08b9e18103833fd17a990f5fc1f07468eb300539606220
BLAKE2b-256 checksum
How to use checksums
a7926922e7c16663a3c6986f93202b350a398a6d2bae06deed700d3bbeb3c7c8
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 11, 2026.

Transparency log

Release files / grammar_of_data-0.1.0-py3-none-macosx_11_0_arm64.whl

Download URL grammar_of_data-0.1.0-py3-none-macosx_11_0_arm64.whl
Size 467.6 kB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
449084b09ac27877b7a8293a922418d7d7467b8432e73ed8069d88ebd756f1eb
BLAKE2b-256 checksum
How to use checksums
bf928276abad0c080da5e13a0b3132336ff97d00934ba99f65123286acff1763
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 11, 2026.

Transparency log

Release files / grammar_of_data-0.1.0-py3-none-macosx_10_12_x86_64.whl

Download URL grammar_of_data-0.1.0-py3-none-macosx_10_12_x86_64.whl
Size 500.0 kB
Tags Python 3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
560e0afccaad5cef938826a65f890a629b0ab60e6770f3c08c110285cafbb0dc
BLAKE2b-256 checksum
How to use checksums
74241ef849b4b8b75980317c6d60fdd18ae00fe743fe23be6d715c095f775ecc
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 11, 2026.

Transparency log

Release history Release notifications | RSS feed

0.2.2

5 release files

0.2.1

5 release files

0.2.0

5 release files

This release

0.1.0 This release

5 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