Great Tables

0.21.0 · active · verified Tue Apr 14

Great Tables is a Python library designed to easily generate information-rich, publication-quality display tables from Pandas or Polars DataFrames. It allows for extensive customization of table components like headers, footers, row labels (stubs), spanner labels, and offers various formatting options for cell values, including nanoplots. The current version is 0.21.0, released on March 3, 2026, and it sees active development with regular updates.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates creating a table using the `GT` class from a Pandas DataFrame (specifically, a built-in dataset). It includes adding a table header and formatting currency and date columns using method chaining. The resulting table automatically renders in notebook environments; for console use, `show()` opens it in a browser.

import pandas as pd
from great_tables import GT
from great_tables.data import sp500

# Filter sp500 using Pandas for a specific date range
start_date = "2010-06-07"
end_date = "2010-06-14"
sp500_mini = sp500[(sp500["date"] >= start_date) & (sp500["date"] <= end_date)]

# Create a display table, add a header, and format columns
gt_table = (
    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")
)

# In a notebook environment, `gt_table` will render automatically.
# In a console, use `gt_table.show()` to open in a browser.
# For demonstration purposes, we'll indicate successful creation.
print("Great Table created successfully (output not shown in console).")

view raw JSON →