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
pip install grammar-of-data
Then import god. The wheel carries its own engine, so there is nothing else to
install.
Every word answers for itself
help(god.keep), help(god.summarize), help(god.add_combinations) — every
verb, function and grammar word has a page with a worked example, a small table
going in and the answer coming out.
The two names to know
A column is col.name, because Python cannot look one up in your data the way R
does. The pipe is >>. Those are the only two differences from the R spelling,
and the rest of the vocabulary is identical.
The manual, live in both languages, is at https://psychometrician.github.io/god-book/.
Release files for grammar-of-data 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| grammar_of_data-0.2.1-py3-none-win_amd64.whl | Python 3 | none | Windows x86-64 | Details |
| grammar_of_data-0.2.1-py3-none-manylinux_2_28_x86_64.whl | Python 3 | none | Linux glibc 2.28+ x86-64 | Details |
| grammar_of_data-0.2.1-py3-none-manylinux_2_28_aarch64.whl | Python 3 | none | Linux glibc 2.28+ ARM64 | Details |
| grammar_of_data-0.2.1-py3-none-macosx_11_0_arm64.whl | Python 3 | none | macOS 11.0+ ARM64 | Details |
| grammar_of_data-0.2.1-py3-none-macosx_10_12_x86_64.whl | Python 3 | none | macOS 10.12+ x86-64 | Details |
Total release size: 2.7 MB
Release files / grammar_of_data-0.2.1-py3-none-win_amd64.whl
| Download URL | grammar_of_data-0.2.1-py3-none-win_amd64.whl |
|---|---|
| Size | 454.6 kB |
| Tags | Python 3 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
d2c2541523b500ce27e535cdc8f07a1ce40f3eb4582c1e6873808df3a2fb25cc
|
|
BLAKE2b-256 checksum How to use checksums |
60edb82a34bc223d7b3c0cacdadbdb26fce0511bd5d06997b9160859203a37dd
|
| 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 15, 2026.
Transparency logRelease files / grammar_of_data-0.2.1-py3-none-manylinux_2_28_x86_64.whl
| Download URL | grammar_of_data-0.2.1-py3-none-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 579.8 kB |
| Tags | Linux glibc 2.28+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
a7beaa6de8266413ab084651ac5bba6fa6bb5aba95367ec395ae3a2b518f4d8b
|
|
BLAKE2b-256 checksum How to use checksums |
d828870705e671cf5843d28c468ed0e178658726b1ace4d4d48053a099cb9012
|
| 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 15, 2026.
Transparency logRelease files / grammar_of_data-0.2.1-py3-none-manylinux_2_28_aarch64.whl
| Download URL | grammar_of_data-0.2.1-py3-none-manylinux_2_28_aarch64.whl |
|---|---|
| Size | 548.8 kB |
| Tags | Linux glibc 2.28+ ARM64 Python 3 |
|
SHA-256 checksum How to use checksums |
f4c2adfa25adb2f00b4d55bc841f69d081d6aad0004d9ae07edcf9ca9359e951
|
|
BLAKE2b-256 checksum How to use checksums |
34ef9525d41081cf389cab9c8fb5fbb013ef7aa25c109e51f65dc709b402d693
|
| 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 15, 2026.
Transparency logRelease files / grammar_of_data-0.2.1-py3-none-macosx_11_0_arm64.whl
| Download URL | grammar_of_data-0.2.1-py3-none-macosx_11_0_arm64.whl |
|---|---|
| Size | 523.8 kB |
| Tags | Python 3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
6f2330a2b1657225d930a1028634b4a72e1a90bd236f0da437ab713225116b71
|
|
BLAKE2b-256 checksum How to use checksums |
087dbb80d6f157eebc8ff5ef8eba08d36a7a2215533cf44d0cfa2a2444b4e126
|
| 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 15, 2026.
Transparency logRelease files / grammar_of_data-0.2.1-py3-none-macosx_10_12_x86_64.whl
| Download URL | grammar_of_data-0.2.1-py3-none-macosx_10_12_x86_64.whl |
|---|---|
| Size | 559.3 kB |
| Tags | Python 3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
26ad73acc08a65d22300595df76c19174485a6744bdbcfd83ff27500a105f175
|
|
BLAKE2b-256 checksum How to use checksums |
bd9ab3cd87e31255b8206e32924dd3f7e030992118201c25f187b3f58de85a9c
|
| 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 15, 2026.
Transparency log