Skills
A skill is a package of structured files that teaches an AI coding agent how to work with a specific tool or framework. The skill below was generated by Great Docs from this project’s documentation. Install it in your agent and it will be able to run commands, edit configuration, write content, and troubleshoot problems without step-by-step guidance from you.
Any agent — install with npx:
npx skills add https://posit-dev.github.io/great-tables/Codex / OpenCode
Tell the agent:
Fetch the skill file at https://posit-dev.github.io/great-tables/skill.md and follow the instructions.Manual — download the skill file:
curl -O https://posit-dev.github.io/great-tables/skill.mdOr browse the SKILL.md file.
SKILL.md
--- name: great-tables description: > Easily generate information-rich, publication-quality tables from Python. Use when writing Python code that uses the great_tables package. license: MIT compatibility: Requires Python >=3.10. --- # Great Tables Easily generate information-rich, publication-quality tables from Python. ## Installation ```bash pip install great-tables ``` ## API overview ### Table Creation All tables created in Great Tables begin by using `GT()`. With this class, we supply the input data table and some basic options for creating a stub and row groups (with the `rowname_col=` and `groupname_col=` arguments). All GT methods are documented on their own pages. - `GT`: Create a **Great Tables** object ### Major structural table parts A table can contain a few useful components for conveying additional information. These include a header (with a titles and subtitle), a footer (with source notes), and additional areas for labels (row group labels, column spanner labels, the stubhead label). We can perform styling on targeted table locations with the [`tab_style()`](`great_tables.GT.tab_style`) method. - `GT.tab_header` - `GT.tab_spanner` - `GT.tab_spanner_delim` - `GT.tab_stub` - `GT.tab_stubhead` - `GT.tab_footnote` - `GT.tab_source_note` - `GT.tab_style` - `GT.tab_options` ### Formatting column data Columns of data can be formatted with the `fmt_*()` methods. We can specify the rows of these columns quite precisely with the `rows` argument. We get to apply these methods exactly once to each data cell (last call wins). Need to do custom formatting? Use the [`fmt()`](`great_tables.GT.fmt`) method and define your own formatter. The `sub_*()` methods allow you to perform substitution operations and `data_color()` provides a lot of power for colorizing body cells based on their data values. - `GT.fmt_number` - `GT.fmt_integer` - `GT.fmt_scientific` - `GT.fmt_engineering` - `GT.fmt_percent` - `GT.fmt_partsper` - `GT.fmt_currency` - `GT.fmt_roman` - `GT.fmt_bytes` - `GT.fmt_date` - `GT.fmt_time` - `GT.fmt_datetime` - `GT.fmt_duration` - `GT.fmt_tf` - `GT.fmt_markdown` - `GT.fmt_units` - `GT.fmt_image` - `GT.fmt_flag` - `GT.fmt_icon` - `GT.fmt_nanoplot` - `GT.fmt` - `GT.sub_missing` - `GT.sub_zero` - `GT.sub_small_vals` - `GT.sub_large_vals` - `GT.sub_values` - `GT.data_color` ### Text transformation The text_*() method take cell data that are solidified into strings and allow for flexible transformations of those string values. Whereas the `fmt_*()` and `sub_*()` methods are phases 1 and 2 of cell data metamorphoses, the text transformation functions are the final phase, acting on strings generated by formatting and substitution functions with no reference to the source values. - `GT.text_replace` - `GT.text_case_when` - `GT.text_case_match` - `GT.text_transform` ### Modifying columns The `cols_*()` methods allow for modifications that act on entire columns. This includes alignment of the data in columns ([`cols_align()`](`great_tables.GT.cols_align`)), hiding columns from view ([`cols_hide()`](`great_tables.GT.cols_hide`)), re-labeling the column labels ([`cols_label()`](`great_tables.GT.cols_label`)), and moving columns around (with the `cols_move*()` methods). - `GT.cols_align` - `GT.cols_width` - `GT.cols_label` - `GT.cols_label_with` - `GT.cols_label_rotate` - `GT.cols_move` - `GT.cols_move_to_start` - `GT.cols_move_to_end` - `GT.cols_reorder` - `GT.cols_hide` - `GT.cols_unhide` - `GT.cols_merge` - `GT.cols_merge_uncert` - `GT.cols_merge_range` - `GT.cols_merge_n_pct` ### Adding rows The [`summary_rows()`](`great_tables.GT.summary_rows`) function adds rows to summarize data within each row group, while [`grand_summary_rows()`](`great_tables.GT.grand_summary_rows`) summarizes across the entire table. - `GT.summary_rows` - `GT.grand_summary_rows` ### Location Targeting and Styling Classes Location targeting is a powerful feature of Great Tables. It allows for the precise selection of table locations for styling (using the `tab_style()` method). The styling classes allow for the specification of the styling properties to be applied to the targeted locations. - `loc.header` - `loc.title` - `loc.subtitle` - `loc.stubhead` - `loc.column_header` - `loc.spanner_labels` - `loc.column_labels` - `loc.grand_summary_stub` - `loc.stub` - `loc.row_groups` - `loc.grand_summary` - `loc.body` - `loc.footer` - `loc.source_notes` - `style.fill` - `style.text` - `style.borders` - `style.css` ### Helper Functions An assortment of helper functions is available in the Great Tables package. The `md()` and `html()` helper functions can be used during label creation with the `tab_header()`, `tab_spanner()`, `tab_stubhead()`, and `tab_source_note()` methods. - `GT.with_id` - `GT.with_locale` - `md`: Interpret input text as Markdown-formatted text - `html`: Interpret input text as HTML-formatted text - `from_column`: Specify that a style value should be fetched from a column in the data - `google_font`: Specify a font from the *Google Fonts* service - `system_fonts`: Get a themed font stack that works well across systems - `define_units`: With `define_units()` you can work with a specially-crafted units notation string and emit the - `nanoplot_options`: Helper for setting the options for a nanoplot ### Table options With the `opt_*()` functions, we have an easy way to set commonly-used table options without having to use `tab_options()` directly. - `GT.opt_stylize` - `GT.opt_footnote_marks` - `GT.opt_row_striping` - `GT.opt_align_table_header` - `GT.opt_vertical_padding` - `GT.opt_horizontal_padding` - `GT.opt_all_caps` - `GT.opt_table_outline` - `GT.opt_table_font` - `GT.opt_css` ### Export There may come a day when you need to export a table to some specific format. A great method for that is `gtsave()`, which allows us to save the table as a standalone image file or PDF. You can also get the table code as an HTML fragment with the `*_raw_html()` methods. - `GT.gtsave` - `GT.show` - `GT.as_raw_html` - `GT.write_raw_html` - `GT.as_latex` ### Pipeline Sometimes, you might want to programmatically manipulate the table while still benefiting from the chained API that **Great Tables** offers. `pipe()` is designed to tackle this issue. - `GT.pipe` ### Value Formatting Functions If you have single values (or lists of them) in need of formatting, we have a set of `val_fmt_*()` functions that have been adapted from the corresponding `fmt_*()` methods. - `vals.fmt_number` - `vals.fmt_integer` - `vals.fmt_scientific` - `vals.fmt_engineering` - `vals.fmt_percent` - `vals.fmt_partsper` - `vals.fmt_currency` - `vals.fmt_roman` - `vals.fmt_bytes` - `vals.fmt_duration` - `vals.fmt_date` - `vals.fmt_time` - `vals.fmt_duration` - `vals.fmt_markdown` - `vals.fmt_image` ### Built-in Datasets The Great Tables package is equipped with sixteen datasets that come in all shapes and sizes. Many examples throughout the help docs use these datasets to quickly demonstrate the features of the package. - `data.countrypops` - `data.sza` - `data.gtcars` - `data.sp500` - `data.pizzaplace` - `data.exibble` - `data.towny` - `data.peeps` - `data.films` - `data.metro` - `data.gibraltar` - `data.constants` - `data.illness` - `data.reactions` - `data.photolysis` - `data.nuclides` ## Resources - [Full documentation](https://posit-dev.github.io/great-tables/) - [llms.txt](llms.txt) — Indexed API reference for LLMs - [llms-full.txt](llms-full.txt) — Comprehensive documentation for LLMs