Skip to main content

Easily generate information-rich, publication-quality tables from Python.

Project description

Python Versions PyPI License Repo Status PyPI Downloads Contributors CI Build Discord Contributor Covenant

Great Tables

Absolutely Delightful Table-making in Python

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.

It all begins with table data in the form of a Pandas DataFrame. 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 by printing it at the console, including it in an notebook environment, or rendering it inside a Quarto document.

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 gt to create a table from the included sp500 dataset:

import great_tables as gt
from great_tables import sp500

# Define the start and end dates for the data range
start_date = "2010-06-07"
end_date = "2010-06-14"

# Filter sp500 using Pandas to dates between `start_date` and `end_date`
sp500_mini = sp500[(sp500["date"] >= start_date) & (sp500["date"] <= end_date)]

# Create a gt table based on the `sp500_mini` table data
(
    gt.GT(data=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")
)

There are ten datasets provided by great_tables: countrypops, sza, gtcars, sp500, pizzaplace, exibble, towny, metro, constants, and illness.

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.

Beyond the functions shown in the simple sp500-based example, there are many possible ways to create super-customized tables. Check out the documentation website to get started via introductory articles for making great_tables. There's a handy Function Reference section that has detailed help for every method and function in the package.

Documentation Site

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.

GitHub Discussions

Another fine venue for discussion is in the gt_package 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!

Discord Server

Finally, there is the gt_package X account. There you'll find tweets about great_tables (including sneak previews about in-development features) and other table-generation packages.

X Follow

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

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.

📄 License

great_tables is licensed under the MIT license.

© Posit Software, PBC.

🏛️ Governance

This project is primarily maintained by Rich Iannone and Michael Chow. Other authors may occasionally assist with some of these duties.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

great-tables-0.1.0.tar.gz (11.9 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

great_tables-0.1.0-py3-none-any.whl (870.8 kB view details)

Uploaded Python 3

File details

Details for the file great-tables-0.1.0.tar.gz.

File metadata

  • Download URL: great-tables-0.1.0.tar.gz
  • Upload date:
  • Size: 11.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for great-tables-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3360caf8097687912968c47089f25b50bbd104665619444b0768f7ddf35ff143
MD5 5ee53887d2883bdcf0b8d038a135a620
BLAKE2b-256 bba4fdb07a0ede8d7fa1054b4d6f1eabd77ed56a350b1321553a67f25dccff4a

See more details on using hashes here.

File details

Details for the file great_tables-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: great_tables-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 870.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for great_tables-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 07e533e354875071c12566085374eeddcd875ce7e80faffdb78fb899d29fe6f2
MD5 093892fb8e2f236e947e6e0805cd2e23
BLAKE2b-256 bf0244740d5f52d92b346883a23431c9398d146524ed97f567aeb7ad76e0e09c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page