With Great Tables anyone can make wonderful-looking tables in Python. The philosophy here is that we can construct a wide variety of useful tables by working with a cohesive set of table components. You can mix and match things like a header and footer, attach a stub (which contains row labels), arrange spanner labels over top of the column labels, and much more. Not only that, but you can format the cell values in a variety of awesome ways.
What You Can Do
- Structure a table with a header, a stub of row labels, row groups, spanners over the column labels, footnotes, and source notes (User Guide).
- Format values with nearly 30
fmt_*()methods: numbers, currencies, percentages, dates and times, durations, scientific notation, units, chemical formulas, Markdown, icons, flags, and images, in any of over 500 locales (User Guide). - Plot in cells with nanoplots: small line, bar, and box plots made from a cell's values (User Guide).
- Color cells by their values with
data_color(), for heatmaps and highlights (User Guide). - Style anything, from a single cell to the whole table, with
tab_style(),tab_options(), and premade themes fromopt_stylize()(User Guide). - Summarize groups of rows, and the whole table, with summary rows (User Guide).
- Make it interactive with
GTI: sorting, searching, column filters, column profiles, pagination, and row selection, in the browser or in Shiny, Streamlit, Panel, Solara, and marimo apps (User Guide). - Export to HTML, LaTeX, or an image or PDF file (User Guide).
It all begins with table data in the form of a Polars or Pandas DataFrame, or a PyArrow table. You then decide how to compose your output table with the elements and formatting you need for the task at hand. Finally, the table is rendered to HTML (the default option), to LaTeX, or to an image file.
A Quick Example
The Great Tables package is designed to be both straightforward yet powerful. The emphasis is on simple methods for the everyday display table needs (but power when you need it). Here is a brief example of how to use Great Tables to create a table from the included sp500 dataset:
import polars as pl
from great_tables import GT, data
# Define the start and end dates for the data range
start_date = "2010-06-07"
end_date = "2010-06-14"
# Filter sp500 to the dates between `start_date` and `end_date`
sp500_mini = data.pl.sp500.filter((pl.col("date") >= start_date) & (pl.col("date") <= end_date))
# Create a display table based on the `sp500_mini` table data
(
GT(sp500_mini)
.tab_header(title="S&P 500", subtitle=f"{start_date} to {end_date}")
.fmt_currency(columns=["open", "high", "low", "close"])
.fmt_date(columns="date", date_style="wd_m_day_year")
.fmt_number(columns="volume", compact=True)
.cols_hide(columns="adj_close")
)
Typically we use Great Tables in a notebook environment or within a Quarto document. Tables won't print to the console, but using the show() method on a table object while in the console will open the HTML table in your default browser.
Interactive Tables
A GTI table is a GT table that readers can work with: it has all the same methods for structuring, formatting, and styling, and i_*() methods that set up what readers can do with it. Out of the box, it can be sorted, searched, and paged through.
import polars as pl
from great_tables import GTI, data
cars = data.pl.gtcars.select(
"mfr", "model", "year", "bdy_style", "ctry_origin", "hp", "mpg_h", "msrp"
).with_columns(pl.col("bdy_style").str.to_titlecase())
(
GTI(cars)
.tab_header(title="Grand Touring Cars", subtitle="47 cars from the gtcars dataset")
.cols_label(
mfr="Make",
model="Model",
year="Year",
bdy_style="Body",
ctry_origin="Origin",
hp="HP",
mpg_h="MPG",
msrp="Price",
)
.fmt_integer(columns=["year", "hp", "mpg_h"], use_seps=False)
.fmt_currency(columns="msrp", decimals=0)
.data_color(columns="hp", palette=["#FFF5EB", "#FDAE6B"])
.i_cols_filter()
.i_cols_profile(columns=["hp", "msrp"])
.i_export("csv")
.i_pagination(page_size=8)
)
The table works on its own in the browser (in a notebook, a Quarto document, or a saved HTML file), and in Python apps, where the app can read and set what the reader filters, sorts, and selects. See Interactive Tables in the User Guide to get started.
Datasets
There are 16 datasets provided by Great Tables: countrypops, sza, gtcars, sp500, pizzaplace, exibble, towny, peeps, films, metro, gibraltar, constants, illness, reactions, photolysis, and nuclides. Each one is available as a Polars DataFrame (e.g., data.pl.gtcars) or as a Pandas DataFrame (e.g., data.pd.gtcars).
All of this tabular data is great for experimenting with the functionality available inside Great Tables and we make extensive use of these datasets in our documentation.
Learning More
Beyond the methods shown here, there are many possible ways to create super-customized tables. Check out the documentation website to get started via the User Guide, and see the Examples for complete tables made with Great Tables. There's a handy Reference section that has detailed help for every method and function in the package.
Community
Let's talk about how to make Great Tables! There are a few locations where there is much potential for discussion.
One such place is in GitHub Discussions. This discussion board is especially great for Q&A, and many people have had their problems solved in there.
Another fine venue for discussion is in our Discord server. This is a good option for asking about the development of Great Tables, pitching ideas that may become features, and sharing your table creations!
Finally, there is the X account. There you'll find posts about Great Tables (including sneak previews about in-development features) and other table-generation packages.
These are all great places to ask questions about how to use the package, discuss some ideas, engage with others, and much more!
Installation
The Great Tables package can be installed from PyPI with:
pip install great_tables
You can also install Great Tables from Conda-Forge by using:
conda install conda-forge::great_tables
Some ways of using interactive tables from Python need an extra: great_tables[widget] for a Jupyter widget, or great_tables[streamlit], great_tables[panel], great_tables[solara], or great_tables[marimo] for those apps (e.g., pip install "great_tables[widget]").
If you encounter a bug, have usage questions, or want to share ideas to make this package better, please feel free to file an issue.
Code of Conduct
Please note that the Great Tables project is released with a contributor code of conduct.
By participating in this project you agree to abide by its terms.
Contributing to Great Tables
There are many ways to contribute to the ongoing development of the Great Tables package. Some contributions can be simple (like fixing typos, improving documentation, filing issues for feature requests or problems, etc.) and others might take more time and care (like answering questions and submitting PRs with code changes). Just know that anything you can do to help would be very much appreciated!
Please read over the contributing guidelines for information on how to get started.
📄 License
Great Tables is licensed under the MIT license.
© Posit Software, PBC.
Citation
If you use Great Tables in your research/project/product, we would appreciate a citation to the package. You can cite the package using the following BibTeX entry:
@software{Iannone_great_tables,
author = {Iannone, Richard},
license = {MIT},
title = {{great-tables: Make awesome display tables using Python.}},
url = {https://github.com/posit-dev/great-tables},
doi = {10.5281/zenodo.14618357}
}
🏛️ Governance
This project is primarily maintained by Rich Iannone. Other authors may occasionally assist with some of these duties.
Metadata
Release files for great-tables 1.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| great_tables-1.2.0.tar.gz | 29.8 MB | Without provenance | Details for great_tables-1.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| great_tables-1.2.0-py3-none-any.whl | Python 3 | none | any | Details for great_tables-1.2.0-py3-none-any.whl |
Total release size: 32.1 MB
Release files / great_tables-1.2.0.tar.gz
| Download URL | great_tables-1.2.0.tar.gz |
|---|---|
| Size | 29.8 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bdaf1457168445702cf6dab5447090b2762ac38da41bc44df0fa2254f5448769
|
|
BLAKE2b-256 checksum How to use checksums |
34f4d57a055a4aa25a1e4070743d4520ae5c68e59717723fe47fc1be8e7aba10
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / great_tables-1.2.0-py3-none-any.whl
| Download URL | great_tables-1.2.0-py3-none-any.whl |
|---|---|
| Size | 2.3 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
830f99440f77d19514355927b8289658e8eedf2beee045ac4c9463a1b42132cf
|
|
BLAKE2b-256 checksum How to use checksums |
efe04c9afe3496adc2d7db8c609259fe046bde22dec92d209f7aa7a60c9a6a59
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Security for great-tables 1.2.0
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.