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_stub_indent` - `GT.row_group_order` - `GT.tab_footnote` - `GT.tab_source_note` - `GT.rm_header` - `GT.rm_stubhead` - `GT.rm_spanners` - `GT.rm_footnotes` - `GT.rm_source_notes` - `GT.tab_style` - `GT.tab_style_body` - `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. The `col_numeric()`, `col_bin()`, and `col_factor()` helpers create color-mapping functions for use with its `fn=` argument. - `GT.fmt_number` - `GT.fmt_integer` - `GT.fmt_scientific` - `GT.fmt_engineering` - `GT.fmt_number_si` - `GT.fmt_percent` - `GT.fmt_partsper` - `GT.fmt_currency` - `GT.fmt_roman` - `GT.fmt_fraction` - `GT.fmt_chem` - `GT.fmt_index` - `GT.fmt_url` - `GT.fmt_email` - `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_passthrough` - `GT.fmt` - `GT.sub_missing` - `GT.sub_zero` - `GT.sub_small_vals` - `GT.sub_large_vals` - `GT.sub_values` - `GT.data_color` - `col_numeric`: Create a color-mapping function for continuous numeric values - `col_bin`: Create a color-mapping function for numeric values cut into bins - `col_factor`: Create a color-mapping function for categorical values ### 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_align_decimal` - `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` - `loc.footnotes` - `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 units as HTML (with the `.to_html()` method). This function is useful as a standalone utility and it powers the `fmt_units()` method in **Great Tables** - `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_footnote_spec` - `GT.opt_footnote_order` - `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` ### Interactive tables An interactive table is one readers can sort, search, filter and page through in the browser. [`opt_interactive()`](`great_tables.GT.opt_interactive`) makes a `GT` table browsable, with the options R gt has for that. A `GTI` table is a `GT` table (all of the methods above can be used to make it) that is an interface readers work with, set up with the `i_*()` methods that only `GTI` tables have. `GTI` is experimental. - `GTI`: Create an interactive **Great Tables** object - `GTI.from_gt` - `GT.opt_interactive` ### Interactive table controls These `GTI` methods set what readers can do with the table and how it's laid out: sorting, searching, resizing, paging and selecting, how its rows look and scroll, how it fits a narrow screen, the view it starts with and keeps, exporting it, and showing what's in the data. - `GTI.i_sorting` - `GTI.i_search` - `GTI.i_resizing` - `GTI.i_pagination` - `GTI.i_selection` - `GTI.i_display` - `GTI.i_scroll` - `GTI.i_responsive` - `GTI.i_view` - `GTI.i_view_state` - `GTI.i_export` - `GTI.i_inspect` ### Interactive columns and exploration The `i_cols_*()` methods set up the table's columns for readers: their filters, their controls, which are pinned and which give way on a narrow screen, and small plots of their values under their labels. Rows can have details that readers open, and tables can be linked, so that the rows selected in one filter another. - `GTI.i_cols_filter` - `GTI.i_cols_controls` - `GTI.i_cols_pin` - `GTI.i_cols_priority` - `GTI.i_cols_profile` - `GTI.i_row_details` - `GTI.i_link` ### Interactive tables in Python and apps An interactive table's view (its search, filters and sort) and selection can be read and set from Python: in a notebook, with the table as a widget, and in Shiny, Streamlit, Panel and Solara apps. A table with many rows can keep them in Python and send the browser a page at a time. Pages an app makes itself (with Flask, Django or FastHTML) can show the tables, with their runtime once. - `GTI.i_as_widget` - `GTI.i_scale` - `shiny.render_gt` - `shiny.output_gt` - `shiny.update_gti` - `streamlit.st_gti` - `streamlit.update_gti` - `streamlit.GTIState` - `panel.GTIPane` - `solara.GTITable` - `web.runtime_tags` - `web.write_runtime` ### 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_number_si` - `vals.fmt_percent` - `vals.fmt_partsper` - `vals.fmt_currency` - `vals.fmt_roman` - `vals.fmt_fraction` - `vals.fmt_chem` - `vals.fmt_index` - `vals.fmt_url` - `vals.fmt_email` - `vals.fmt_bytes` - `vals.fmt_duration` - `vals.fmt_date` - `vals.fmt_time` - `vals.fmt_datetime` - `vals.fmt_markdown` - `vals.fmt_image` ### Built-in Datasets The Great Tables package is equipped with 16 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. The `load_dataset()` function provides a convenient way to load any dataset as either a Pandas or Polars DataFrame. - `load_dataset`: Load a dataset from the library as a specified table type - `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 - [Source code](https://github.com/posit-dev/great-tables)