From f4e6c60403a2d62f4cb3a10e2a8513e607433619 Mon Sep 17 00:00:00 2001 From: rich-iannone Date: Mon, 30 Sep 2024 14:48:44 +0000 Subject: [PATCH] deploy: b83594fb4dc82c6f0a28e22a75c7668f59c9c1a9 --- blog/bring-your-own-df/index.html | 90 +- blog/design-philosophy/index.html | 240 +- blog/index.html | 20 +- blog/index.xml | 3212 ++++----- blog/introduction-0.2.0/index.html | 240 +- blog/introduction-0.3.0/index.html | 640 +- blog/introduction-0.4.0/index.html | 400 +- blog/introduction_great_tables.html | 640 +- blog/polars-styling/index.html | 562 +- blog/superbowl-squares/index.html | 240 +- .../index.html | 160 +- examples/index.html | 560 +- get-started/basic-column-labels.html | 242 +- get-started/basic-formatting.html | 406 +- get-started/basic-header.html | 240 +- get-started/basic-stub.html | 320 +- get-started/basic-styling.html | 964 +-- get-started/colorizing-with-data.html | 400 +- get-started/column-selection.html | 322 +- get-started/index.html | 322 +- get-started/nanoplots.html | 800 +-- get-started/row-selection.html | 482 +- get-started/table-theme-options.html | 720 +- get-started/table-theme-premade.html | 1108 ++-- get-started/targeted-styles.html | 560 +- reference/GT.as_raw_html.html | 4 +- reference/GT.cols_align.html | 80 +- reference/GT.cols_hide.html | 80 +- reference/GT.cols_label.html | 240 +- reference/GT.cols_move.html | 80 +- reference/GT.cols_move_to_end.html | 160 +- reference/GT.cols_move_to_start.html | 160 +- reference/GT.cols_width.html | 320 +- reference/GT.data_color.html | 240 +- reference/GT.fmt.html | 80 +- reference/GT.fmt_bytes.html | 80 +- reference/GT.fmt_currency.html | 80 +- reference/GT.fmt_date.html | 80 +- reference/GT.fmt_datetime.html | 80 +- reference/GT.fmt_image.html | 80 +- reference/GT.fmt_integer.html | 80 +- reference/GT.fmt_markdown.html | 80 +- reference/GT.fmt_nanoplot.html | 320 +- reference/GT.fmt_number.html | 80 +- reference/GT.fmt_percent.html | 80 +- reference/GT.fmt_roman.html | 80 +- reference/GT.fmt_scientific.html | 80 +- reference/GT.fmt_time.html | 80 +- reference/GT.fmt_units.html | 160 +- reference/GT.html | 5842 ++++++++--------- reference/GT.opt_align_table_header.html | 80 +- reference/GT.opt_all_caps.html | 80 +- reference/GT.opt_horizontal_padding.html | 160 +- reference/GT.opt_row_striping.html | 80 +- reference/GT.opt_stylize.html | 160 +- reference/GT.opt_table_font.html | 160 +- reference/GT.opt_table_outline.html | 80 +- reference/GT.opt_vertical_padding.html | 160 +- reference/GT.show.html | 158 +- reference/GT.sub_missing.html | 80 +- reference/GT.sub_zero.html | 80 +- reference/GT.tab_header.html | 160 +- reference/GT.tab_options.html | 400 +- reference/GT.tab_source_note.html | 80 +- reference/GT.tab_spanner.html | 160 +- reference/GT.tab_stub.html | 160 +- reference/GT.tab_stubhead.html | 160 +- reference/GT.tab_style.html | 160 +- reference/define_units.html | 80 +- reference/from_column.html | 160 +- reference/google_font.html | 160 +- reference/system_fonts.html | 80 +- search.json | 4 +- sitemap.xml | 222 +- 74 files changed, 12940 insertions(+), 12940 deletions(-) diff --git a/blog/bring-your-own-df/index.html b/blog/bring-your-own-df/index.html index 1e9d5c34d..e9f8999ce 100644 --- a/blog/bring-your-own-df/index.html +++ b/blog/bring-your-own-df/index.html @@ -251,7 +251,7 @@

The

The challenge of removing hard dependencies

Removing hard dependencies on DataFrame libraries is worthwhile, but requires special handling for all DataFrame specific actions. To illustrate consider the Great Tables output below, which is produced from a Pandas DataFrame:

-
+
import pandas as pd
 import polars as pl
 from great_tables import GT
@@ -261,52 +261,52 @@ 

GT(df_pandas)

-
+
@@ -344,7 +344,7 @@

Getting column names

The code below shows the different methods required to get column names as a list from Pandas and Polars.

-
+
df_pandas.columns.tolist()  # pandas
 df_polars.columns           # polars
@@ -352,7 +352,7 @@

Getting column names<

Notice that the two lines of code aren’t too different—Pandas just requires an extra .tolist() piece. We could create a special function, that returns a list of names, depending on the type of the input DataFrame.

-
+
def get_column_names(data) -> list[str]:
 
     # pandas specific ----
@@ -379,7 +379,7 @@ 

How we made Pa

Inverting dependency with databackend

Inverting dependency on DataFrame libraries means that we check whether something is a specific type of DataFrame, without using imports. This is done through the package databackend, which we copied into Great Tables.

It works by creating placeholder classes, which stand in for the DataFrames they’re detecting:

-
+
from great_tables._databackend import AbstractBackend
 
 
@@ -408,7 +408,7 @@ 

Inve

Separating concerns with singledispatch

While databackend removes dependencies, the use of singledispatch from the built-in functools module separates out the logic for handling Polars DataFrames from the logic for Pandas DataFrames. This makes it easier to think one DataFrame at a time, and also gets us better type hinting.

Here’s a basic example, showing the get_column_names() function re-written using singledispatch:

-
+
from functools import singledispatch
 
 
@@ -439,7 +439,7 @@ 

Se
  • The use of PdDataFrame is what signifies “run this for Pandas DataFrames”.
  • With the get_column_names implementations defined, we can call it like a normal function:

    -
    +
    get_column_names(df_pandas)  # pandas version
     get_column_names(df_polars)  # polars version
    diff --git a/blog/design-philosophy/index.html b/blog/design-philosophy/index.html index f4816cd76..4237492cb 100644 --- a/blog/design-philosophy/index.html +++ b/blog/design-philosophy/index.html @@ -237,54 +237,54 @@

    What is a table, re
  • the data is primarily text
  • Let’s look at an example of a simple table with actual data to tie this theory to practice.

    -
    +
    -
    +

    @@ -450,7 +450,7 @@

    A
  • Table Footer: a place for additional information pertaining to the table content
  • Here’s a table that takes advantage of the different components available in Great Tables. It contains the names and addresses of people.

    -
    +
    Show the code
    from great_tables import GT, md, system_fonts
    @@ -474,52 +474,52 @@ 

    A )

    -
    +

    @@ -622,7 +622,7 @@

    Formatting

  • a compact integer value (fmt_integer()): 134K
  • The problem grows worse when values need to be conveyed as images or plots. If you’re a medical analyst, for example, you might need to effectively convey whether test results for a patient are improving or worsening over time. Reading such data as a sequence of numbers across a row can slow interpretation. But by using nanoplots, available as the fmt_nanoplot() formatting method, readers can spot trends right away. Here’s an example that provides test results over a series of days.

    -
    +
    Show the code
    from great_tables import GT, md
    @@ -650,52 +650,52 @@ 

    Formatting

    )
    -
    +
    diff --git a/blog/index.html b/blog/index.html index 8b5e97001..f78628d51 100644 --- a/blog/index.html +++ b/blog/index.html @@ -266,7 +266,7 @@

    Great Blogposts

    - + @@ -277,7 +277,7 @@

    Great Blogposts

    Rich Iannone
    - + @@ -288,7 +288,7 @@

    Great Blogposts

    Michael Chow
    - + @@ -299,7 +299,7 @@

    Great Blogposts

    Michael Chow
    - + @@ -310,7 +310,7 @@

    Great Blogposts

    Rich Iannone and Michael Chow
    - + @@ -321,7 +321,7 @@

    Great Blogposts

    Rich Iannone
    - + @@ -332,7 +332,7 @@

    Great Blogposts

    Rich Iannone
    - + @@ -343,7 +343,7 @@

    Great Blogposts

    Michael Chow
    - + @@ -354,7 +354,7 @@

    Great Blogposts

    Rich Iannone
    - + @@ -365,7 +365,7 @@

    Great Blogposts

    Michael Chow
    - + diff --git a/blog/index.xml b/blog/index.xml index 0d96ef342..fafd97034 100644 --- a/blog/index.xml +++ b/blog/index.xml @@ -52,7 +52,7 @@ Tip
  • formatting for very small numbers in scientific notation.
  • Great Tables provides the necessary functionality for all three requirements. Here is a summary table that tabulates rate constants for mercaptan compounds undergoing reaction with OH, O3, and Cl:

    -
    +
    Show the Code
    "humanist")
     )
    -
    +
    Jul 8, 2024
    May 16, 2024
    Apr 24, 2024
    Apr 4, 2024
    Mar 19, 2024
    Feb 16, 2024
    Feb 8, 2024
    Jan 24, 2024
    Jan 8, 2024
    Jan 4, 2024
    @@ -385,7 +385,7 @@ font-style: inherit;">"humanist")

    We added the nanoplots feature to Great Tables in v0.4.0 (check out the intro blog post for a quick explainer) so that tables can contain small, info-packed plots that fit reasonably well into a table context. They are interactive in that hovering over the data points provides additional plot information. This approach brings together the advantages of plots (elucidation of trends in data) and tables (access to numerical values representing the data points) in a single summary visualization.

    Version 0.10.0 of Great Tables adds the gibraltar dataset, which provides meteorological data (temeperature, humidity, wind speed, etc.) for the entire month of May 2024 at Gibraltar Airport Station.

    Nanoplots, as mentioned, are great for condensing a lot of information into a small area. Our example here with the gibraltar dataset takes all of the temperature and humidity data for the first 10 days of May 2023 and displays them in easy-to-explore nanoplots across two columns:

    -
    +
    Show the Code
    "humidity"]
     )
    -
    +
    @@ -1323,7 +1323,7 @@ $14.8M

    The challenge of removing hard dependencies

    Removing hard dependencies on DataFrame libraries is worthwhile, but requires special handling for all DataFrame specific actions. To illustrate consider the Great Tables output below, which is produced from a Pandas DataFrame:

    -
    +
    import pandas = pl.from_pandas(df_pandas)
     
     GT(df_pandas)
    -
    +
    @@ -1444,7 +1444,7 @@ font-style: inherit;">= pl.from_pandas(df_pandas)

    Getting column names

    The code below shows the different methods required to get column names as a list from Pandas and Polars.

    -
    +
    df_pandas.columns.tolist()  # pandas
    @@ -1456,7 +1456,7 @@ font-style: inherit;"># polars

    Notice that the two lines of code aren’t too different—Pandas just requires an extra .tolist() piece. We could create a special function, that returns a list of names, depending on the type of the input DataFrame.

    -
    +
    ")

    Inverting dependency with databackend

    Inverting dependency on DataFrame libraries means that we check whether something is a specific type of DataFrame, without using imports. This is done through the package databackend, which we copied into Great Tables.

    It works by creating placeholder classes, which stand in for the DataFrames they’re detecting:

    -
    +
    from great_tables._databackend "I'm a pandas DataFrame!!!")
    Separating concerns with singledispatch

    While databackend removes dependencies, the use of singledispatch from the built-in functools module separates out the logic for handling Polars DataFrames from the logic for Pandas DataFrames. This makes it easier to think one DataFrame at a time, and also gets us better type hinting.

    Here’s a basic example, showing the get_column_names() function re-written using singledispatch:

    -
    +
    from functools return data.columns
  • The use of PdDataFrame is what signifies “run this for Pandas DataFrames”.
  • With the get_column_names implementations defined, we can call it like a normal function:

    -
    +
    get_column_names(df_pandas)  # pandas version
    @@ -1731,54 +1731,54 @@ Tables made with computers (left to right): (1) a DataFrame printed at the conso
     
  • the data is primarily text
  • Let’s look at an example of a simple table with actual data to tie this theory to practice.

    -
    +
    -
    +
    @@ -1944,7 +1944,7 @@ A schematic with the complete set of table components that can be utilized in Table Footer: a place for additional information pertaining to the table content

    Here’s a table that takes advantage of the different components available in Great Tables. It contains the names and addresses of people.

    -
    +
    Show the code
    "14px",
     )
    -
    +
    @@ -2198,7 +2198,7 @@ A table of named individuals redone, Great Tables style!
  • a compact integer value (fmt_integer()): 134K
  • The problem grows worse when values need to be conveyed as images or plots. If you’re a medical analyst, for example, you might need to effectively convey whether test results for a patient are improving or worsening over time. Reading such data as a sequence of numbers across a row can slow interpretation. But by using nanoplots, available as the fmt_nanoplot() formatting method, readers can spot trends right away. Here’s an example that provides test results over a series of days.

    -
    +
    Show the code
    "Measurements from Day 3 through Day 9.")
     )
    -
    +
    @@ -2461,7 +2461,7 @@ font-style: inherit;">"Measurements from Day 3 through Day 9.")

    The recent v0.4.0 release of Great Tables contains nanoplots as a major new feature. So, in this post I’ll concentrate on showing you all the things you can do with nanoplots. What are nanoplots? Well, with nanoplots you can do this:

    -
    +
    Show the code
    "Measurements from Day 3 through to Day 8.")
     )
    -
    +
    @@ -2680,7 +2680,7 @@ font-style: inherit;">"Measurements from Day 3 through to Day 8.")

    Nanoplots, small interactive plots in your table

    Nanoplots are small yet information-laden plots that fit nicely into table cells. They are interactive, allowing for more information to be shown on hovering (or through touch when that interaction is available). Nanoplots try to show individual data points with reasonably good visibility (space is limited, this is going in a table after all!) and the plot representations change depending on the data fed into them.

    We can generate nanoplots via the fmt_nanoplot() method. Let’s make two nanoplots of the two different available plot types: "line" and "bar":

    -
    +
    random_numbers_df = pl.DataFrame(
    @@ -2743,52 +2743,52 @@ background-color: null;
     font-style: inherit;">"bar")
     )
    -
    +
    @@ -2835,7 +2835,7 @@ font-style: inherit;">"bar")

    Adding reference lines and highlighted areas

    It’s possible to add in a reference line and a reference area to individual plots. These may be useful to highlight a particular statistic (e.g., median or minimum value) or a bounded region of interest (e.g., the area between the first and third quartiles). Here is an example of how to use these options via the reference_line= and reference_area= arguments:

    -
    +
    (
         GT(random_numbers_df, rowname_col"median"])
     )
    -
    +
    @@ -2978,7 +2978,7 @@ font-style: inherit;">"median"])

    Simple bars

    We can also have single-value bar plots and line plots. These will run in the horizontal direction and such plots are meant for easy value comparisons (which works great in tables). To make this work, give fmt_nanoplot() a column of numeric values. The following example shows how fmt_nanoplot() can be used to create single-value bar and line plots.

    -
    +
    single_vals_df = pl.DataFrame(
    @@ -3051,52 +3051,52 @@ background-color: null;
     font-style: inherit;">"line")
     )
    -
    +
    @@ -3148,7 +3148,7 @@ font-style: inherit;">"line")

    Customizing with nanoplot_options()

    We provide a lot of options for customizing your nanoplots. With the nanoplot_options() helper function, it’s possible to change the look and feel for a set of nanoplots. The options= argument of fmt_nanoplot() is where you’d need to invoke that helper function. Some possibilities for customization include determining which nanoplot elements are present, changing the sizes and colors of different elements, and a whole lot more! Here’s an example where both line- and bar-based nanoplots retain their basic compositional elements, but their appearance is quite different.

    -
    +
    from great_tables "blue",
         )
     )
    -
    +
    @@ -3365,7 +3365,7 @@ font-style: inherit;">"blue",

    Modifying the widths of columns

    Before v0.3.0, you could not alter the widths of individual columns. This meant that to great extent your content decided the width of individual columns. Even though browsers do an adequate job in sizing the widths of table columns, it doesn’t always result in a pleasing-to-look-at table. What if you want more space? Maybe you want consistently-sized columns? There’s many reasons to want to have a choice in the matter and the new cols_width() method now makes this possible.

    Here’s an example where the widths of all columns are set with our preferred length values (in px).

    -
    +
    from great_tables "50px"
         )
     )
    -
    +
    @@ -3540,7 +3540,7 @@ font-style: inherit;">"50px"

    Setting options across the entire table with tab_options()

    The new tab_options() method gives you the freedom to specify any of dozens of global style and layout options for the table. Want a font that’s used across all cells? Use the table_font_names= option. Do you need to make the text smaller, but only in the stub? Use stub_font_size= for that. The number of options is perhaps overwhelming at first but we think you’ll enjoy having them around nonetheless. It makes styling the table (and developing your own table themes) a relatively simple task.

    Here’s an example that creates a table with a few common components and then uses tab_options() to set up a collection of fonts for the table with the (also new) system_fonts() function:

    -
    +
    from great_tables ="industrial"))
    -
    +
    @@ -3746,59 +3746,59 @@ font-style: inherit;">"industrial"))

    Note that table_font_names= accepts a list of fonts that operate as fallbacks for users across different systems (i.e., they may not have the font you have). And the system_fonts() helper function in Great Tables makes this easy by providing you with themed, local font stacks that are meant to work across different computing platforms.

    Here’s another example where we set the width of the table to span across the entire page (or containing element).

    -
    +
    gt_tbl.tab_options(table_width="100%")
    -
    +
    @@ -3888,59 +3888,59 @@ font-style: inherit;">"100%")

    One more where the background color of the table is set to "lightcyan":

    -
    +
    gt_tbl.tab_options(table_background_color="lightcyan")
    -
    +
    @@ -4034,59 +4034,59 @@ font-style: inherit;">"lightcyan")

    Using the new opt_*() methods to do more complex tasks with table options

    While tab_options() is a great method for setting global table options, sometimes you want to set a number of them at once for a combined effect. For that type of operation, we have the opt_*() series of methods. A common thing you might do is align the content in the table header, we can make that an easy thing with opt_align_table_header():

    -
    +
    gt_tbl.opt_align_table_header(align="left")
    -
    +
    @@ -4177,55 +4177,55 @@ font-style: inherit;">"left")

    With that, you don’t have to hunt through the myriad options within tab_options() to find the two args you need to get the job done.

    The opt_all_caps() method transforms the text within the column labels, the stub, and in all row groups so that we get an all-capitalized (yet somewhat sized down) look that better differentiates the labels from the data. It’s rather easy to use, just do this:

    -
    +
    gt_tbl.opt_all_caps()
    -
    +
    @@ -4316,59 +4316,59 @@ font-style: inherit;">"left")

    This sets nine options you’d otherwise set in tab_options() all at once, making life generally easier.

    Here’s one last example, this time using opt_vertical_padding(). You’d use that if you’re dissatisfied with the level of top/bottom padding within cells of all locations (e.g., in the table body, in the column labels, etc.). You can either make a table taller or more ‘compressed’ with a single argument: scale=. Here’s an example where the amount of vertical padding is reduced, resulting in a table taking up less vertical space.

    -
    +
    gt_tbl.opt_vertical_padding(scale=0.5)
    -
    +
    @@ -4470,7 +4470,7 @@ font-style: inherit;">0.5)

    A new formatting method: fmt_image()

    Wouldn’t it be great to add graphics to your table? The fmt_image() method provides an easy way to add image files on disk into table body cells. The cells need to contain some reference to an image file. The path= and file_pattern= arguments give you some flexibility in defining exactly where the image files live.

    Here’s an example using the metro dataset that’s included within Great Tables.

    -
    +
    from great_tables.data "700px")
     )
    -
    +
    @@ -4682,7 +4682,7 @@ font-style: inherit;">"700px")
  • Away team digit: 7
  • Let’s say you choose the digits above, and write this as 4/7—meaning a final digit of 4 for home and 7 for away. You would mark yourself on this square:

    -
    +
    Code
    df "Away")
     )
    -
    +
    @@ -5023,7 +5023,7 @@ font-style: inherit;">"Away")

    What squares are most likely to win?

    We looked back at games for the KC Chiefs (away), and games for the San Francisco 49ers (home), and calculated the proportion of the time each team ended with a specific digit. Putting this together for the two teams, here is the chance of winning on a given square:

    -
    +
    Code
    '<span style="float: right;">Source data: [Lee Sharp
     )
    -
    +
    @@ -5554,7 +5554,7 @@ Appendix: analysis and code

    Code

    -
    +
    import polars '<span style="float: right;">Source data: [Lee Sharp
         )
     )
    -
    +
    @@ -6067,7 +6067,7 @@ font-style: inherit;">'<span style="float: right;">Source data: [Lee Sharp

    We enjoy working on Great Tables because we want everybody to easily make beautiful tables. Tables don’t have to be boring, they really could be captivating and insightful. With every release we get closer and closer to realizing our mission and, as such, we’re happy to announce the v0.2.0 release that’s now on PyPI.

    The really big feature that’s available with this release is the data_color() method. It gives you several options for colorizing data cells based on the underlying data. The method automatically scales color values according to the data in order to emphasize differences or reveal trends. The example below emphasizes large currency values with a "darkgreen" fill color.

    -
    +
    from great_tables "darkgreen"]
         )
     )
    -
    +
    @@ -6193,7 +6193,7 @@ font-style: inherit;">"darkgreen"]

    Note that we use columns= to specify which columns get the colorizing treatment (just currency here) and the palette= is given as a list of color values. From this we can see that the 65100.0 value polarizes the data coloring process; it is "darkgreen" while all other values are "lightblue" (with no interpolated colors in between). Also, isn’t it nice that the text adapts to the background color?

    The above example is suitable for emphasizing large values, but, maybe you consider the extreme value to be something that’s out of bounds? For that, we can use the domain= and na_value= arguments to gray-out the extreme values. We’ll also nicely format the currency column in this next example.

    -
    +
    (
         GT(exibble[[False
         )
     )
    -
    +
    @@ -6342,7 +6342,7 @@ font-style: inherit;">False

    Now the very large value is in "lightgray", making all other values easier to compare. We did setting domain=[0, 50] and specifying na_color="lightgray". This caused the out-of-bounds value of 65100 to have a light gray background. Notice that the values are also formatted as currencies, and this is thanks to fmt_currency() which never interferes with styling.

    Here’s a more inspirational example that uses a heavily-manipulated version of the countrypops dataset (thanks again, Polars!) along with a color treatment that’s mediated by data_color(). Here, the population values can be easily compared by the amount of "purple" within them.

    -
    +
    from great_tables.data 1.7e5])
     )
    -
    +
    @@ -6616,7 +6616,7 @@ font-style: inherit;">1.7e5])

    However, there are fewer options for styling tables for presentation. You could convert from polars to pandas, and use the built-in pandas DataFrame styler, but this has one major limitation: you can’t use polars expressions.

    As it turns out, polars expressions make styling tables very straightforward. The same polars code that you would use to select or filter combines with Great Tables to highlight, circle, or bolden text.

    In this post, I’ll show how Great Tables uses polars expressions to make delightful tables, like the one below.

    -
    +
    Code
    max())
     )
    -
    +
    @@ -6993,7 +6993,7 @@ font-style: inherit;">max())

    Creating GT object

    First, we’ll import the necessary libraries, and do a tiny bit of data processing.

    -
    +
    import polars "Temp"
     

    The default polars output above is really helpful for data analysis! By passing it to the GT constructor, we can start getting it ready for presentation.

    -
    +
    gt_air = GT(pl_airquality)
     
     gt_air
    -
    +
    @@ -7189,7 +7189,7 @@ font-style: inherit;">= GT(pl_airquality)

    Set title and subtitle

    The simplest method in gt is GT.tab_header(), which lets you add a title and subtitle.

    -
    +
    (
         gt_air
     
    @@ -7210,52 +7210,52 @@ font-style: inherit;">"Daily measurements in New York City (May 1-10, 1973)"    )
     )
    -
    +
    @@ -7337,7 +7337,7 @@ font-style: inherit;">"Daily measurements in New York City (May 1-10, 1973)"

    Set body styles

    The .tab_style() method sets styles—like fill color, or text properties—on different parts of the table. Let’s use it twice with a polars expression. First to highlight the row corresponding to the max Wind value, and then to bold that value.

    -
    +
    from great_tables "Wind", is_max_wind)
         )
     )
    -
    +
    @@ -7521,7 +7521,7 @@ font-style: inherit;">"Wind", is_max_wind)
  • More readable labels for columns themselves.
  • Use GT.tab_spanner() to set labels on groups of columns.

    -
    +
    time_cols = [=cs.exclude(time_cols)
     
     gt_with_spanners
    -
    +
    @@ -7690,7 +7690,7 @@ font-style: inherit;">=cs.exclude(time_cols)

    Notice that there are now labels for “Time” and “Measurement” sitting above the column names. This is useful for emphasizing columns that share something in common.

    Use GT.cols_labels() with html() to create human-friendly labels (e.g. convert things like cal_m_2 to cal/m2).

    -
    +
    from great_tables "Temp,<br>&deg;F")
         )
     )
    -
    +
    @@ -7853,7 +7853,7 @@ font-style: inherit;">"Temp,<br>&deg;F")

    Putting it all together

    Finally, we’ll combine everything from the sections above into a single block of code, and use a few more rows of data.

    -
    +
    Code
    max())
     )
    -
    +
    @@ -8247,7 +8247,7 @@ font-style: inherit;">pip install great_tables

    A Basic Table

    Let’s get right to making a display table with Great Tables. The package has quite a few datasets and so we’ll start by making use of the very small, but useful, exibble dataset. After importing the GT class and that dataset, we’ll introduce that Pandas table to GT().

    -
    +
    from great_tables # Now, show the gt table
     gt_tbl
    -
    +
    @@ -8433,7 +8433,7 @@ font-style: inherit;"># Now, show the gt table

    More Complex Tables

    Let’s take things a bit further and create a table with the included gtcars dataset. Great Tables provides a large selection of methods and they let you refine the table display. They were designed so that you can easily create a really presentable and beautiful table visualization.

    For this next table, we’ll incorporate a Stub component and this provides a place for the row labels. Groupings of rows will be generated through categorical values in a particular column (we just have to cite the column name for that to work). We’ll add a table title and subtitle with tab_header(). The numerical values will be formatted with the fmt_integer() and fmt_currency() methods. Column labels will be enhanced via cols_label() and a source note will be included through use of the tab_source_note() method. Here is the table code, followed by the table itself.

    -
    +
    from great_tables "Source: the gtcars dataset within the Great Tables package.")
     )
    -
    +
    @@ -8711,7 +8711,7 @@ font-style: inherit;">"Source: the gtcars dataset within the Great Tables packag

    With the six different methods applied, the table looks highly presentable! The rendering you’re seeing here has been done through Quarto (this entire site has been generated with quartodoc). If you haven’t yet tried out Quarto, we highly recommend it!

    For this next example we’ll use the airquality dataset (also included in the package; it’s inside the data submodule). With this table, two spanners will be added with the tab_spanner() method. This method is meant to be easy to use, you only need to provide the text for the spanner label and the columns associated with the spanner. We also make it easy to move columns around. You can use cols_move_to_start() (example of that below) and there are also the cols_move_to_end() and cols_move() methods.

    -
    +
    from great_tables.data "Day"])
     )
    -
    +
    @@ -8998,7 +8998,7 @@ font-style: inherit;">"Day"])
  • fmt(): set a column format with a formatting function
  • We strive to make formatting a simple task but we also want to provide the user a lot of power through advanced options and we ensure that varied combinations of options works well. For example, most of the formatting methods have a locale= argument. We want as many users as possible to be able to format numbers, dates, and times in ways that are familiar to them and are adapted to their own regional specifications. Now let’s take a look at an example of this with a smaller version of the exibble dataset:

    -
    +
    exibble_smaller = exibble[["h_m_s_p")
     )
    -
    +
    @@ -9137,7 +9137,7 @@ font-style: inherit;">"h_m_s_p")

    Using Styles within a Table

    We can use the tab_style() method in combination with loc.body() and various style.*() functions to set styles on cells of data within the table body. For example, the table-making code below applies a yellow background color to the targeted cells.

    -
    +
    from great_tables 2])
         )
     )
    -
    +
    @@ -9290,7 +9290,7 @@ font-style: inherit;">2])

    Aside from style.fill() we can also use style.text() and style.borders() to focus the styling on cell text and borders. Here’s an example where we perform several types of styling on targeted cells (the key is to put the style.*() calls in a list).

    -
    +
    from great_tables "currency")
         )
     )
    -
    +
    @@ -9467,7 +9467,7 @@ font-style: inherit;">"currency")

    Column Selection with Polars (and How It Helps with Styling)

    Styles can also be specified using Polars expressions. For example, the code below uses the Temp column to set color to "lightyellow" or "lightblue".

    -
    +
    import polars "Temp")
         )
     )
    -
    +
    @@ -9640,7 +9640,7 @@ font-style: inherit;">"Temp")

    We can deftly mix and match Polars column selectors and expressions. This gives us great flexibility in selecting specific columns and rows. Here’s an example of doing that again with tab_style():

    -
    +
    import polars.selectors 70
         )
     )
    -
    +
    diff --git a/blog/introduction-0.2.0/index.html b/blog/introduction-0.2.0/index.html index 5dafdb5fb..5fefaf4ac 100644 --- a/blog/introduction-0.2.0/index.html +++ b/blog/introduction-0.2.0/index.html @@ -214,7 +214,7 @@

    Great Tables v0.2.0: Easy Data Coloring

    We enjoy working on Great Tables because we want everybody to easily make beautiful tables. Tables don’t have to be boring, they really could be captivating and insightful. With every release we get closer and closer to realizing our mission and, as such, we’re happy to announce the v0.2.0 release that’s now on PyPI.

    The really big feature that’s available with this release is the data_color() method. It gives you several options for colorizing data cells based on the underlying data. The method automatically scales color values according to the data in order to emphasize differences or reveal trends. The example below emphasizes large currency values with a "darkgreen" fill color.

    -
    +
    from great_tables import GT, exibble
     
     (
    @@ -225,52 +225,52 @@ 

    Great Tables v0.2.0: Easy Data Coloring

    ) )
    -
    +
    @@ -314,7 +314,7 @@

    Great Tables v0.2.0: Easy Data Coloring

    Note that we use columns= to specify which columns get the colorizing treatment (just currency here) and the palette= is given as a list of color values. From this we can see that the 65100.0 value polarizes the data coloring process; it is "darkgreen" while all other values are "lightblue" (with no interpolated colors in between). Also, isn’t it nice that the text adapts to the background color?

    The above example is suitable for emphasizing large values, but, maybe you consider the extreme value to be something that’s out of bounds? For that, we can use the domain= and na_value= arguments to gray-out the extreme values. We’ll also nicely format the currency column in this next example.

    -
    +
    (
         GT(exibble[["currency", "date", "row"]].head(4), rowname_col="row")
         .data_color(
    @@ -330,52 +330,52 @@ 

    Great Tables v0.2.0: Easy Data Coloring

    ) )
    -
    +
    @@ -419,7 +419,7 @@

    Great Tables v0.2.0: Easy Data Coloring

    Now the very large value is in "lightgray", making all other values easier to compare. We did setting domain=[0, 50] and specifying na_color="lightgray". This caused the out-of-bounds value of 65100 to have a light gray background. Notice that the values are also formatted as currencies, and this is thanks to fmt_currency() which never interferes with styling.

    Here’s a more inspirational example that uses a heavily-manipulated version of the countrypops dataset (thanks again, Polars!) along with a color treatment that’s mediated by data_color(). Here, the population values can be easily compared by the amount of "purple" within them.

    -
    +
    from great_tables.data import countrypops
     import polars as pl
     import polars.selectors as cs
    @@ -445,52 +445,52 @@ 

    Great Tables v0.2.0: Easy Data Coloring

    .data_color(palette=["white", "purple"], domain=[0, 1.7e5]) )
    -
    +
    diff --git a/blog/introduction-0.3.0/index.html b/blog/introduction-0.3.0/index.html index df30fd32c..2d616c436 100644 --- a/blog/introduction-0.3.0/index.html +++ b/blog/introduction-0.3.0/index.html @@ -227,7 +227,7 @@

    Great Tables v0.3.0: So Many Style Options!

    Modifying the widths of columns

    Before v0.3.0, you could not alter the widths of individual columns. This meant that to great extent your content decided the width of individual columns. Even though browsers do an adequate job in sizing the widths of table columns, it doesn’t always result in a pleasing-to-look-at table. What if you want more space? Maybe you want consistently-sized columns? There’s many reasons to want to have a choice in the matter and the new cols_width() method now makes this possible.

    Here’s an example where the widths of all columns are set with our preferred length values (in px).

    -
    +
    from great_tables import GT, exibble
     
     exibble_mini = exibble[["num", "char", "date", "datetime", "row"]].head(5)
    @@ -244,52 +244,52 @@ 

    Modifying ) )

    -
    +
    @@ -362,7 +362,7 @@

    Modifying

    Setting options across the entire table with tab_options()

    The new tab_options() method gives you the freedom to specify any of dozens of global style and layout options for the table. Want a font that’s used across all cells? Use the table_font_names= option. Do you need to make the text smaller, but only in the stub? Use stub_font_size= for that. The number of options is perhaps overwhelming at first but we think you’ll enjoy having them around nonetheless. It makes styling the table (and developing your own table themes) a relatively simple task.

    Here’s an example that creates a table with a few common components and then uses tab_options() to set up a collection of fonts for the table with the (also new) system_fonts() function:

    -
    +
    from great_tables import md, system_fonts
     
     gt_tbl = (
    @@ -382,52 +382,52 @@ 

    gt_tbl.tab_options(table_font_names=system_fonts(name="industrial"))

    -
    +
    @@ -518,55 +518,55 @@

    system_fonts() helper function in Great Tables makes this easy by providing you with themed, local font stacks that are meant to work across different computing platforms.

    Here’s another example where we set the width of the table to span across the entire page (or containing element).

    -
    +
    gt_tbl.tab_options(table_width="100%")
    -
    +

    @@ -656,55 +656,55 @@

    :

    -
    +
    gt_tbl.tab_options(table_background_color="lightcyan")
    -
    +

    @@ -798,55 +798,55 @@

    Using the new opt_*() methods to do more complex tasks with table options

    While tab_options() is a great method for setting global table options, sometimes you want to set a number of them at once for a combined effect. For that type of operation, we have the opt_*() series of methods. A common thing you might do is align the content in the table header, we can make that an easy thing with opt_align_table_header():

    -
    +
    gt_tbl.opt_align_table_header(align="left")
    -
    +
    @@ -937,55 +937,55 @@

    tab_options() to find the two args you need to get the job done.

    The opt_all_caps() method transforms the text within the column labels, the stub, and in all row groups so that we get an all-capitalized (yet somewhat sized down) look that better differentiates the labels from the data. It’s rather easy to use, just do this:

    -
    +
    gt_tbl.opt_all_caps()
    -
    +

    @@ -1076,55 +1076,55 @@

    tab_options() all at once, making life generally easier.

    Here’s one last example, this time using opt_vertical_padding(). You’d use that if you’re dissatisfied with the level of top/bottom padding within cells of all locations (e.g., in the table body, in the column labels, etc.). You can either make a table taller or more ‘compressed’ with a single argument: scale=. Here’s an example where the amount of vertical padding is reduced, resulting in a table taking up less vertical space.

    -
    +
    gt_tbl.opt_vertical_padding(scale=0.5)
    -
    +

    @@ -1226,7 +1226,7 @@

    A new formatting method: fmt_image()

    Wouldn’t it be great to add graphics to your table? The fmt_image() method provides an easy way to add image files on disk into table body cells. The cells need to contain some reference to an image file. The path= and file_pattern= arguments give you some flexibility in defining exactly where the image files live.

    Here’s an example using the metro dataset that’s included within Great Tables.

    -
    +
    from great_tables.data import metro
     from importlib_resources import files
     
    @@ -1245,52 +1245,52 @@ 

    A new fo .tab_options(table_width="700px") )

    -
    +
    diff --git a/blog/introduction-0.4.0/index.html b/blog/introduction-0.4.0/index.html index 075e5448a..baa8dc6ea 100644 --- a/blog/introduction-0.4.0/index.html +++ b/blog/introduction-0.4.0/index.html @@ -223,7 +223,7 @@

    Great Tables v0.4.0: Nanoplots and More

    The recent v0.4.0 release of Great Tables contains nanoplots as a major new feature. So, in this post I’ll concentrate on showing you all the things you can do with nanoplots. What are nanoplots? Well, with nanoplots you can do this:

    -
    +
    Show the code
    from great_tables import GT, md
    @@ -250,52 +250,52 @@ 

    Great Tables v0.4.0: Nanoplots and More

    )
    -
    +
    @@ -374,7 +374,7 @@

    Great Tables v0.4.0: Nanoplots and More

    Nanoplots, small interactive plots in your table

    Nanoplots are small yet information-laden plots that fit nicely into table cells. They are interactive, allowing for more information to be shown on hovering (or through touch when that interaction is available). Nanoplots try to show individual data points with reasonably good visibility (space is limited, this is going in a table after all!) and the plot representations change depending on the data fed into them.

    We can generate nanoplots via the fmt_nanoplot() method. Let’s make two nanoplots of the two different available plot types: "line" and "bar":

    -
    +
    random_numbers_df = pl.DataFrame(
         {
             "i": range(1, 5),
    @@ -393,52 +393,52 @@ 

    .fmt_nanoplot(columns="bars", plot_type="bar") )

    -
    +
    @@ -485,7 +485,7 @@

    Adding reference lines and highlighted areas

    It’s possible to add in a reference line and a reference area to individual plots. These may be useful to highlight a particular statistic (e.g., median or minimum value) or a bounded region of interest (e.g., the area between the first and third quartiles). Here is an example of how to use these options via the reference_line= and reference_area= arguments:

    -
    +
    (
         GT(random_numbers_df, rowname_col="i")
         .fmt_nanoplot(
    @@ -500,52 +500,52 @@ 

    reference_area=["max", "median"]) )

    -
    +
    @@ -592,7 +592,7 @@

    Simple bars

    We can also have single-value bar plots and line plots. These will run in the horizontal direction and such plots are meant for easy value comparisons (which works great in tables). To make this work, give fmt_nanoplot() a column of numeric values. The following example shows how fmt_nanoplot() can be used to create single-value bar and line plots.

    -
    +
    single_vals_df = pl.DataFrame(
         {
             "i": range(1, 6),
    @@ -607,52 +607,52 @@ 

    Simple bars

    .fmt_nanoplot(columns="lines", plot_type="line") )
    -
    +
    @@ -704,7 +704,7 @@

    Simple bars

    Customizing with nanoplot_options()

    We provide a lot of options for customizing your nanoplots. With the nanoplot_options() helper function, it’s possible to change the look and feel for a set of nanoplots. The options= argument of fmt_nanoplot() is where you’d need to invoke that helper function. Some possibilities for customization include determining which nanoplot elements are present, changing the sizes and colors of different elements, and a whole lot more! Here’s an example where both line- and bar-based nanoplots retain their basic compositional elements, but their appearance is quite different.

    -
    +
    from great_tables import nanoplot_options
     
     (
    @@ -735,52 +735,52 @@ 

    Customiz ) )

    -
    +
    diff --git a/blog/introduction_great_tables.html b/blog/introduction_great_tables.html index bc7c3943c..f309c1883 100644 --- a/blog/introduction_great_tables.html +++ b/blog/introduction_great_tables.html @@ -237,7 +237,7 @@

    Introducing Great Tables

    A Basic Table

    Let’s get right to making a display table with Great Tables. The package has quite a few datasets and so we’ll start by making use of the very small, but useful, exibble dataset. After importing the GT class and that dataset, we’ll introduce that Pandas table to GT().

    -
    +
    from great_tables import GT, exibble
     
     # Create a display table with the `exibble` dataset
    @@ -246,52 +246,52 @@ 

    A Basic Table

    # Now, show the gt table gt_tbl
    -
    +
    @@ -413,7 +413,7 @@

    A Basic Table

    More Complex Tables

    Let’s take things a bit further and create a table with the included gtcars dataset. Great Tables provides a large selection of methods and they let you refine the table display. They were designed so that you can easily create a really presentable and beautiful table visualization.

    For this next table, we’ll incorporate a Stub component and this provides a place for the row labels. Groupings of rows will be generated through categorical values in a particular column (we just have to cite the column name for that to work). We’ll add a table title and subtitle with tab_header(). The numerical values will be formatted with the fmt_integer() and fmt_currency() methods. Column labels will be enhanced via cols_label() and a source note will be included through use of the tab_source_note() method. Here is the table code, followed by the table itself.

    -
    +
    from great_tables import GT, md, html
     from great_tables.data import gtcars
     
    @@ -432,52 +432,52 @@ 

    More Complex Tables .tab_source_note(source_note="Source: the gtcars dataset within the Great Tables package.") )

    -
    +
    @@ -605,7 +605,7 @@

    More Complex Tables

    With the six different methods applied, the table looks highly presentable! The rendering you’re seeing here has been done through Quarto (this entire site has been generated with quartodoc). If you haven’t yet tried out Quarto, we highly recommend it!

    For this next example we’ll use the airquality dataset (also included in the package; it’s inside the data submodule). With this table, two spanners will be added with the tab_spanner() method. This method is meant to be easy to use, you only need to provide the text for the spanner label and the columns associated with the spanner. We also make it easy to move columns around. You can use cols_move_to_start() (example of that below) and there are also the cols_move_to_end() and cols_move() methods.

    -
    +
    from great_tables.data import airquality
     
     airquality_mini = airquality.head(10).assign(Year=1973)
    @@ -627,52 +627,52 @@ 

    More Complex Tables .cols_move_to_start(columns=["Year", "Month", "Day"]) )

    -
    +

    @@ -822,7 +822,7 @@

    Formatting Table Ce
  • fmt(): set a column format with a formatting function
  • We strive to make formatting a simple task but we also want to provide the user a lot of power through advanced options and we ensure that varied combinations of options works well. For example, most of the formatting methods have a locale= argument. We want as many users as possible to be able to format numbers, dates, and times in ways that are familiar to them and are adapted to their own regional specifications. Now let’s take a look at an example of this with a smaller version of the exibble dataset:

    -
    +
    exibble_smaller = exibble[["date", "time"]].head(4)
     
     (
    @@ -832,52 +832,52 @@ 

    Formatting Table Ce .fmt_time(columns="time", time_style="h_m_s_p") )

    -
    +

    @@ -919,7 +919,7 @@

    Formatting Table Ce

    Using Styles within a Table

    We can use the tab_style() method in combination with loc.body() and various style.*() functions to set styles on cells of data within the table body. For example, the table-making code below applies a yellow background color to the targeted cells.

    -
    +
    from great_tables import GT, style, loc
     from great_tables.data import airquality
     
    @@ -933,52 +933,52 @@ 

    Using Styles w ) )

    -
    +

    @@ -1044,7 +1044,7 @@

    Using Styles w

    Aside from style.fill() we can also use style.text() and style.borders() to focus the styling on cell text and borders. Here’s an example where we perform several types of styling on targeted cells (the key is to put the style.*() calls in a list).

    -
    +
    from great_tables import GT, style, exibble
     
     (
    @@ -1067,52 +1067,52 @@ 

    Using Styles w ) )

    -
    +

    @@ -1169,7 +1169,7 @@

    Using Styles w

    Column Selection with Polars (and How It Helps with Styling)

    Styles can also be specified using Polars expressions. For example, the code below uses the Temp column to set color to "lightyellow" or "lightblue".

    -
    +
    import polars as pl
     
     from great_tables import GT, from_column, style, loc
    @@ -1193,52 +1193,52 @@ 

    ) )

    -
    +

    @@ -1304,7 +1304,7 @@

    +
    import polars.selectors as cs
     
     (
    @@ -1318,52 +1318,52 @@ 

    ) )

    -
    +

    diff --git a/blog/polars-styling/index.html b/blog/polars-styling/index.html index cff2bd113..71a9e9f01 100644 --- a/blog/polars-styling/index.html +++ b/blog/polars-styling/index.html @@ -227,7 +227,7 @@

    Great Tables: The Polars DataFrame Styler of Your Dreams

    However, there are fewer options for styling tables for presentation. You could convert from polars to pandas, and use the built-in pandas DataFrame styler, but this has one major limitation: you can’t use polars expressions.

    As it turns out, polars expressions make styling tables very straightforward. The same polars code that you would use to select or filter combines with Great Tables to highlight, circle, or bolden text.

    In this post, I’ll show how Great Tables uses polars expressions to make delightful tables, like the one below.

    -
    +
    Code
    import polars as pl
    @@ -282,52 +282,52 @@ 

    Great Tables: The Polars DataFrame Styler of Your Dreams

    )
    -
    +
    @@ -476,7 +476,7 @@

    Th

    Creating GT object

    First, we’ll import the necessary libraries, and do a tiny bit of data processing.

    -
    +
    import polars as pl
     import polars.selectors as cs
     
    @@ -502,57 +502,57 @@ 

    Creating GT object

    The default polars output above is really helpful for data analysis! By passing it to the GT constructor, we can start getting it ready for presentation.

    -
    +
    gt_air = GT(pl_airquality)
     
     gt_air
    -
    +

    @@ -628,7 +628,7 @@

    Creating GT object

    Set title and subtitle

    The simplest method in gt is GT.tab_header(), which lets you add a title and subtitle.

    -
    +
    (
         gt_air
     
    @@ -639,52 +639,52 @@ 

    Set title and subti ) )

    -
    +
    @@ -766,7 +766,7 @@

    Set title and subti

    Set body styles

    The .tab_style() method sets styles—like fill color, or text properties—on different parts of the table. Let’s use it twice with a polars expression. First to highlight the row corresponding to the max Wind value, and then to bold that value.

    -
    +
    from great_tables import style, loc
     
     is_max_wind = pl.col("Wind") == pl.col("Wind").max()
    @@ -788,52 +788,52 @@ 

    Set body styles

    ) )
    -
    +

    @@ -920,7 +920,7 @@

    Set column spannersMore readable labels for columns themselves.

    Use GT.tab_spanner() to set labels on groups of columns.

    -
    +
    time_cols = ["Year", "Month", "Day"]
     
     gt_with_spanners = (
    @@ -939,52 +939,52 @@ 

    Set column spanners gt_with_spanners

    -
    +

    @@ -1065,7 +1065,7 @@

    Set column spanners

    Notice that there are now labels for “Time” and “Measurement” sitting above the column names. This is useful for emphasizing columns that share something in common.

    Use GT.cols_labels() with html() to create human-friendly labels (e.g. convert things like cal_m_2 to cal/m2).

    -
    +
    from great_tables import html
     
     (
    @@ -1078,52 +1078,52 @@ 

    Set column spanners ) )

    -
    +

    @@ -1208,7 +1208,7 @@

    Set column spanners

    Putting it all together

    Finally, we’ll combine everything from the sections above into a single block of code, and use a few more rows of data.

    -
    +
    Code
    import polars as pl
    @@ -1263,52 +1263,52 @@ 

    Putting it all tog )

    -
    +
    diff --git a/blog/superbowl-squares/index.html b/blog/superbowl-squares/index.html index df36d2c19..44a27e720 100644 --- a/blog/superbowl-squares/index.html +++ b/blog/superbowl-squares/index.html @@ -237,7 +237,7 @@

    What is Super B
  • Away team digit: 7
  • Let’s say you choose the digits above, and write this as 4/7—meaning a final digit of 4 for home and 7 for away. You would mark yourself on this square:

    -
    +
    Code
    df = (
    @@ -261,52 +261,52 @@ 

    What is Super B )

    -
    +

    @@ -484,7 +484,7 @@

    Why analyze squares?

    What squares are most likely to win?

    We looked back at games for the KC Chiefs (away), and games for the San Francisco 49ers (home), and calculated the proportion of the time each team ended with a specific digit. Putting this together for the two teams, here is the chance of winning on a given square:

    -
    +
    Code
    import polars as pl
    @@ -557,52 +557,52 @@ 

    What s )

    -
    +
    @@ -817,7 +817,7 @@

    Method

    Code

    -
    +
    import polars as pl
     import polars.selectors as cs
     from great_tables import GT, md
    @@ -887,52 +887,52 @@ 

    Code

    ) )
    -
    +
    diff --git a/blog/tables-for-scientific-publishing/index.html b/blog/tables-for-scientific-publishing/index.html index ee9049128..5cf4b526e 100644 --- a/blog/tables-for-scientific-publishing/index.html +++ b/blog/tables-for-scientific-publishing/index.html @@ -252,7 +252,7 @@

    Unit and scie
  • formatting for very small numbers in scientific notation.
  • Great Tables provides the necessary functionality for all three requirements. Here is a summary table that tabulates rate constants for mercaptan compounds undergoing reaction with OH, O3, and Cl:

    -
    +
    Show the Code
    from great_tables import GT
    @@ -298,52 +298,52 @@ 

    Unit and scie )

    -
    +

    @@ -465,7 +465,7 @@

    Nanoplots

    We added the nanoplots feature to Great Tables in v0.4.0 (check out the intro blog post for a quick explainer) so that tables can contain small, info-packed plots that fit reasonably well into a table context. They are interactive in that hovering over the data points provides additional plot information. This approach brings together the advantages of plots (elucidation of trends in data) and tables (access to numerical values representing the data points) in a single summary visualization.

    Version 0.10.0 of Great Tables adds the gibraltar dataset, which provides meteorological data (temeperature, humidity, wind speed, etc.) for the entire month of May 2024 at Gibraltar Airport Station.

    Nanoplots, as mentioned, are great for condensing a lot of information into a small area. Our example here with the gibraltar dataset takes all of the temperature and humidity data for the first 10 days of May 2023 and displays them in easy-to-explore nanoplots across two columns:

    -
    +
    Show the Code
    from great_tables import GT, nanoplot_options
    @@ -522,52 +522,52 @@ 

    Nanoplots

    )
    -
    +
    diff --git a/examples/index.html b/examples/index.html index b49979873..0cd53138b 100644 --- a/examples/index.html +++ b/examples/index.html @@ -204,7 +204,7 @@

    Examples

    -
    +
    Show the Code
    import polars as pl
    @@ -232,52 +232,52 @@ 

    Examples

    )
    -
    +
    @@ -357,7 +357,7 @@

    Examples

    -
    +
    Show the Code
    from great_tables import GT, html
    @@ -389,52 +389,52 @@ 

    Examples

    )
    -
    +
    @@ -566,7 +566,7 @@

    Examples

    -
    +
    Show the Code
    from great_tables import GT
    @@ -607,52 +607,52 @@ 

    Examples

    )
    -
    +
    @@ -799,7 +799,7 @@

    Examples

    -
    +
    Show the Code
    from great_tables import GT, html
    @@ -840,52 +840,52 @@ 

    Examples

    )
    -
    +
    @@ -976,7 +976,7 @@

    Examples

    -
    +
    Show the Code
    from great_tables import GT, html
    @@ -1007,52 +1007,52 @@ 

    Examples

    )
    -
    +
    @@ -1467,54 +1467,54 @@

    Examples

    View source ⬀     Blog post (R code) ⬀

    -
    +
    -
    +
    @@ -2024,7 +2024,7 @@

    Examples

    View source ⬀     Notebook ⬀

    -
    +
    Show the Code
    import polars as pl
    @@ -2081,52 +2081,52 @@ 

    Examples

    coffee_table
    -
    +
    diff --git a/get-started/basic-column-labels.html b/get-started/basic-column-labels.html index 4e94a5802..cc5469261 100644 --- a/get-started/basic-column-labels.html +++ b/get-started/basic-column-labels.html @@ -352,7 +352,7 @@

    Column Labels

  • Month, Day: the numeric month and day of month for the record
  • We know that all measurements took place in 1973, so a year column will be added to the dataset before it is passed to the GT() class.

    -
    +
    from great_tables import GT, html
     from great_tables.data import airquality
     
    @@ -484,7 +484,7 @@ 

    Column Labels

    Adding Column Spanners

    Let’s organize the time information under a Time spanner label, and put the other columns under a Measurement spanner label. We can do this with the tab_spanner() method.

    -
    +
    gt_airquality = (
         GT(airquality_mini)
         .tab_header(
    @@ -503,52 +503,52 @@ 

    Adding Column Spann gt_airquality

    -
    +
    @@ -687,7 +687,7 @@

    Moving and R
  • customize the column labels so that they are more descriptive (using cols_label())
  • Let’s do both of these things in the next example:

    -
    +
    (
         gt_airquality
         .cols_move_to_start(columns=["Year", "Month", "Day"])
    @@ -699,52 +699,52 @@ 

    Moving and R ) )

    -
    +

    @@ -881,58 +881,58 @@

    Moving and R

    Targeting Columns for columns=

    In the above examples, we selected columns to span or move using a list of column names (as strings). However, Great Tables supports a wide range of ways to select columns.

    For example, you can use a lambda function:

    -
    +
    (
         GT(airquality_mini)
         .cols_move_to_start(columns=lambda colname: colname.endswith("R"))
     )
    -
    +
    diff --git a/get-started/basic-formatting.html b/get-started/basic-formatting.html index fcee2a425..c16e7e017 100644 --- a/get-started/basic-formatting.html +++ b/get-started/basic-formatting.html @@ -341,7 +341,7 @@

    Formatting Values

    The values within the table body, specifically those within the body cells, can be formatted with a large selection of fmt_*() methods like fmt_number(), fmt_integer(), fmt_scientific(), and more. Let’s use a portion of the exibble dataset and introduce some formatting to the cell values. First, we’ll generate the basic GT object and take a look at the table without any cell formatting applied.

    -
    +
    from great_tables import GT
     from great_tables.data import exibble
     from great_tables import vals
    @@ -350,52 +350,52 @@ 

    Formatting Values

    gt_ex
    -
    +
    @@ -449,57 +449,57 @@

    Formatting Values

    The num column contains both small and much larger numbers. We can use the fmt_number() method to obtain formatted values have a fixed level of decimal precision and grouping separators. At the same time, we’ll format the numeric values in currency column to get monetary values.

    -
    +
    gt_ex = gt_ex.fmt_number(columns="num", decimals=2).fmt_currency(columns="currency")
     
     gt_ex
    -
    +
    @@ -553,7 +553,7 @@

    Formatting Values

    Dates and times can be formatted as well. As long as they are in ISO 8601 form, the fmt_date() and fmt_time() methods can be used to format such values. These methods have corresponding date_style= and time_style= arguments that accept a number of keywords that act as preset formatting styles.

    -
    +
    gt_ex = (
         gt_ex.fmt_date(columns="date", date_style="m_day_year")
         .fmt_time(columns="time", time_style="h_m_p")
    @@ -561,52 +561,52 @@ 

    Formatting Values

    gt_ex
    -
    +
    @@ -660,57 +660,57 @@

    Formatting Values

    It’s possible to format cells that have already been formatted. Using a formatting method again on previously formatted cells will always work within the ‘last-formatted-wins’ rule.

    -
    +
    gt_ex = gt_ex.fmt_date(columns="date", date_style="wday_day_month_year")
     
     gt_ex
    -
    +
    @@ -764,57 +764,57 @@

    Formatting Values

    Within the selected columns= we can choose to target specific cells with the rows= argument. The latter argument allows us to pass in a list of row indices.

    -
    +
    gt_ex = gt_ex.fmt_currency(columns="currency", rows=[2, 3, 4], currency="GBP")
     
     gt_ex
    -
    +
    @@ -879,7 +879,7 @@

    , "fr", "de-AT", etc.) will result in numeric formatting specific to the chosen locale

    Here are a number of examples that use vals.fmt_number().

    -
    +
    fmt_number_1 = vals.fmt_number([1.64, 3.26, 3000.63, 236742.37])
     fmt_number_2 = vals.fmt_number([1.64, 3.26, 3000.63, 236742.37], compact=True)
     fmt_number_3 = vals.fmt_number([1.64, 3.26, 3000.63, 236742.37], decimals=3)
    @@ -896,7 +896,7 @@ 

    vals.fmt_scientific().

    -
    +
    fmt_sci_1 = vals.fmt_scientific([0.00064, 7.353, 863454.63])
     fmt_sci_2 = vals.fmt_scientific([1.64, 3.26, 3000.63], decimals=3)
     fmt_sci_3 = vals.fmt_scientific([1.64, 3.26, 3000.63], exp_style="E")
    @@ -911,7 +911,7 @@ 

    vals.fmt_date() and vals.fmt_time().

    -
    +
    fmt_date_1 = vals.fmt_date(
         ["2015-03-15", "2017-08-18", "2020-04-12"], date_style="wday_month_day_year"
     )
    diff --git a/get-started/basic-header.html b/get-started/basic-header.html
    index 6063c2903..8240e2ca8 100644
    --- a/get-started/basic-header.html
    +++ b/get-started/basic-header.html
    @@ -335,7 +335,7 @@ 

    Header and Footer

    The way that we add components like the Table Header and source notes in the Table Footer is to use the tab_*() family of methods. A Table Header is easy to add so let’s see how the previous table looks with a title and a subtitle. We can add this component using the tab_header() method:

    -
    +
    from great_tables import GT, md, html
     from great_tables.data import islands
     
    @@ -351,52 +351,52 @@ 

    Header and Footer

    ) )
    -
    +

    @@ -464,7 +464,7 @@

    Header and Footer

    The Header table component provides an opportunity to describe the data that’s presented. Using subtitle= allows us to insert a subtitle, which is an optional part of the Header. We may also style the title= and subtitle= using Markdown! We do this by wrapping the values passed to title= or subtitle= with the md() helper function (we may also use html() in a similar fashion). Here is an example with the table data truncated for brevity:

    -
    +
    # Make a display table with the `islands_tbl` table;
     # put a heading just above the column labels
     gt_tbl = (
    @@ -477,52 +477,52 @@ 

    Header and Footer

    gt_tbl
    -
    +
    @@ -558,7 +558,7 @@

    Header and Footer

    A source note can be added to the table’s Footer through use of the tab_source_note() method. It works in the same way as tab_header() (it also allows for Markdown inputs) except it can be called multiple times—each invocation results in the addition of a source note.

    -
    +
    # Display the `islands_tbl` data with a heading and two source notes
     (
         gt_tbl
    @@ -570,52 +570,52 @@ 

    Header and Footer

    ) )
    -
    +
    diff --git a/get-started/basic-stub.html b/get-started/basic-stub.html index 5782555ac..1b4f99a52 100644 --- a/get-started/basic-stub.html +++ b/get-started/basic-stub.html @@ -346,7 +346,7 @@

    Stub (Row Labels)

    Row names

    An easy way to generate a Stub part is by specifying a stub column in the GT() class with the rowname_col= argument. This will signal to Great Tables that the named column should be used as the stub, using the contents of that column to make row labels. Let’s add a stub with our islands dataset by using rowname_col= in the call to GT():

    -
    +
    from great_tables import GT, md, html
     from great_tables.data import islands
     
    @@ -354,52 +354,52 @@ 

    Row names

    GT(islands_mini).tab_stub(rowname_col="name")
    -
    +
    @@ -461,59 +461,59 @@

    Row names

    Notice that the landmass names are now placed to the left? That’s the Stub. Notably, there is a prominent border to the right of it but there’s no label above the Stub. We can change this and apply what’s known as a stubhead label through use of the tab_stubhead() method:

    -
    +
    (
         GT(islands_mini)
         .tab_stub(rowname_col="name")
         .tab_stubhead(label="landmass")
     )
    -
    +
    @@ -579,7 +579,7 @@

    Row names

    Row groups

    Let’s incorporate row groups into the display table. This divides rows into groups, creating row groups, and results in a display of a row group labels right above the each group. This can be easily done with a table containing row labels and the key is to use the groupname_col= argument of the GT() class. Here we will create three row groups (with row group labels "continent", "country", and "subregion") to have a grouping of rows.

    -
    +
    island_groups = islands.head(10).assign(group = ["subregion"] * 2 + ["country"] * 2 + ["continent"] * 6)
     
     (
    @@ -588,52 +588,52 @@ 

    Row groups

    .tab_stubhead(label="landmass") )
    -
    +
    @@ -707,55 +707,55 @@

    Row groups

    GT convenience arguments

    Rather than using the GT.tab_stub() method, the GT(rowname_col=..., groupname_col=...) arguments provide a quick way to specify row names and groups.

    -
    +
    GT(island_groups, rowname_col="name", groupname_col="group")
    -
    +
    diff --git a/get-started/basic-styling.html b/get-started/basic-styling.html index 4f55bfc5f..c24d795bb 100644 --- a/get-started/basic-styling.html +++ b/get-started/basic-styling.html @@ -359,7 +359,7 @@

    Stying the Table Body

    Great Tables can add styles—like color, text properties, and borders—on many different parts of the displayed table. The following set of examples shows how to set styles on the body of table, where the data cells are located.

    For the examples on this page, we’ll use the included airquality dataset to set up GT objects for both Pandas and Polars DataFrames.

    -
    +
    import polars as pl
     
     from great_tables import GT, from_column, style, loc
    @@ -373,58 +373,58 @@ 

    Stying the Table Body

    Style basics

    We use the tab_style() method in combination with loc.body() to set styles on cells of data in the table body. For example, the table-making code below applies a yellow background color to specific cells.

    -
    +
    gt_air.tab_style(
         style=style.fill(color="yellow"),
         locations=loc.body(columns="Temp", rows=[1, 2])
     )
    -
    +
    @@ -498,58 +498,58 @@

    Style basics

    Customizing Borders

    Let’s use style.borders() to place borders around targeted cells. In this next example, the table has a red dashed border above two rows.

    -
    +
    gt_air.tab_style(
         style=style.borders(sides="top", color="red", style="dashed", weight="3px"),
         locations=loc.body(rows=[1, 2])
     )
    -
    +
    @@ -618,58 +618,58 @@

    Customizing Borders

    Customizing Text

    We can style text with by using the style.text() function. This gives us many customization possibilities for any text we target. For example, the Solar_R column below has green, bolded text in a custom font.

    -
    +
    gt_air.tab_style(
         style=style.text(color="green", font="Times New Roman", weight="bold"),
         locations=loc.body(columns="Solar_R")
     )
    -
    +
    @@ -739,7 +739,7 @@

    Customizing Text

    Column-based Styles

    In addition to setting styles to specific values (e.g., a "yellow" background fill), you can also use parameter values from table columns to specify styles. The way to do this is to use the from_column() helper function to access those values.

    -
    +
    df = pl.DataFrame({"x": [1, 2], "background": ["lightyellow", "lightblue"]})
     
     (
    @@ -750,52 +750,52 @@ 

    Column-based Styles ) )

    -
    +
    @@ -829,7 +829,7 @@

    Column-based Styles

    Combining Styling with cols_hide()

    One common approach is to specify a style from a column, and then hide that column in the final output. For example, we can add a background column to our airquality data:

    -
    +
    color_map = {
         True: "lightyellow",
         False: "lightblue"
    @@ -914,7 +914,7 @@ 

    Combining

    Notice that the dataset now has a background column set to either "lightyellow" or "lightblue", depending on whether Temp is above 70.

    We can then use this background column to set the fill color of certain body cells, and then hide the background column since we don’t need that in our finalized display table:

    -
    +
    (
         GT(with_color)
         .tab_style(
    @@ -924,52 +924,52 @@ 

    Combining .cols_hide(columns="background") )

    -
    +
    @@ -1043,7 +1043,7 @@

    Combining

    Using Polars expressions

    Styles can also be specified using Polars expressions. For example, the code below uses the Temp column to set color to "lightyellow" or "lightblue".

    -
    +
    # A Polars expression defines color based on `Temp`
     temp_color = (
         pl.when(pl.col("Temp") > 70)
    @@ -1056,52 +1056,52 @@ 

    Using Pol locations=loc.body("Temp") )

    -
    +

    @@ -1171,7 +1171,7 @@

    Using Pol

    Using functions

    You can also use a function, that takes the DataFrame and returns a Series with a style value for each row.

    This is shown below on a pandas DataFrame.

    -
    +
    def map_color(df):
         return (df["Temp"] > 70).map(
             {True: "lightyellow", False: "lightblue"}
    @@ -1183,52 +1183,52 @@ 

    Using functions

    locations=loc.body("Temp") )
    -
    +

    @@ -1300,7 +1300,7 @@

    Specifying col

    Using polars selectors

    If you are using Polars, you can use column selectors and expressions for selecting specific columns and rows:

    -
    +
    import polars.selectors as cs
     
     gt_pl_air.tab_style(
    @@ -1311,52 +1311,52 @@ 

    Using polars select ) )

    -
    +

    @@ -1426,7 +1426,7 @@

    Using polars select

    Using a function

    For tools like pandas, you can use a function (or lambda) to select rows. The function should take a DataFrame, and output a boolean Series.

    -
    +
    gt_air.tab_style(
         style=style.fill(color="yellow"),
         locations=loc.body(
    @@ -1435,52 +1435,52 @@ 

    Using a function

    ) )
    -
    +

    @@ -1550,58 +1550,58 @@

    Using a function

    Multiple styles and locations

    We can use a list within style= to apply multiple styles at once. For example, the code below sets fill and border styles on the same set of body cells.

    -
    +
    gt_air.tab_style(
         style=[style.fill(color="yellow"), style.borders(sides="all")],
         locations=loc.body(columns="Temp", rows=[1, 2]),
     )
    -
    +
    @@ -1667,7 +1667,7 @@

    Multiple sty

    Note that you can also pass a list to locations=!

    -
    +
    gt_air.tab_style(
         style=style.fill(color="yellow"),
         locations=[
    @@ -1676,52 +1676,52 @@ 

    Multiple sty ] )

    -
    +

    @@ -1787,7 +1787,7 @@

    Multiple sty

    You can also combine Polars selectors with a row filtering expression, in order to select a combination of columns and rows.

    -
    +
    import polars.selectors as cs
     
     gt_pl_air.tab_style(
    @@ -1798,52 +1798,52 @@ 

    Multiple sty ) )

    -
    +

    diff --git a/get-started/colorizing-with-data.html b/get-started/colorizing-with-data.html index a440b8f9a..e025f3359 100644 --- a/get-started/colorizing-with-data.html +++ b/get-started/colorizing-with-data.html @@ -345,7 +345,7 @@

    Colorizing with Data

    You sometimes come across heat maps in data visualization, and they’re used to represent data values with color gradients. This technique is great for identifying patterns, trends, outliers, and missing data when there’s lots of data. Tables can have this sort of treatment as well! Typically, formatted numeric values are shown along with some color treatment coinciding with the underlying data values.

    We can make this possible in Great Tables by using the data_color() method. Let’s start with a simple example, using a Polars DataFrame with three columns of values. We can introduce that data to GT() and use data_color() without any arguments.

    -
    +
    from great_tables import GT
     import polars as pl
     
    @@ -359,52 +359,52 @@ 

    Colorizing with Data

    GT(simple_df).data_color()
    -
    +
    @@ -455,55 +455,55 @@

    Colorizing with Data

    Setting palette colors

    While this first example illustrated some basic things, the common thing to do in practices to provide a list of colors to the palette= argument. Let’s choose two colors "green" and "red" and place them in that order.

    -
    +
    GT(simple_df).data_color(palette=["blue", "red"])
    -
    +
    @@ -555,55 +555,55 @@

    Setting palette col

    Coloring missing values with na_color

    There is a lone "None" value in the float column, and it has a gray background. Thoughout the Great Tables package, missing values are treated in different ways and, in this case, it’s given a default color value. We can change that with the na_color= argument. Let’s try it now:

    -
    +
    GT(simple_df).data_color(palette=["blue", "red"], na_color="#FFE4C4")
    -
    +

    @@ -655,7 +655,7 @@

    Colo

    Using domain= to color values across columns

    The previous usages of the data_color() method were such that the color ranges encompassed the boundaries of the data values. That can be changed with the domain= argument, which expects a list of two values (a lower and an upper value). Let’s use the range [0, 10] on the first two columns, integer and float, and not the third (since a numerical domain is incompatible with string-based values). Here’s the table code for that:

    -
    +
    (
         GT(simple_df)
         .data_color(
    @@ -666,52 +666,52 @@ 

    ) )

    -
    +

    @@ -764,7 +764,7 @@

    Bringing it all together

    For a more advanced treatment of data colorization in the table, let’s take the sza dataset (available in the great_tables.data submodule) and vigorously reshape it with Polars so that solar zenith angles are arranged as rows by month, and the half-hourly clock times are the columns (from early morning to solar noon).

    Once the pivot()ing is done, we can introduce that that table to the GT() class, placing the names of the months in the table stub. We will use data_color() with a domain that runs from 90 to 0 (here, 90° is sunrise, and 0° is represents the sun angle that’s directly overhead). There are months where the sun rises later in the morning, before the sunrise times we’ll see missing values in the dataset, and na_color="white" will handle those cases. Okay, that’s the plan, and now here’s the code:

    -
    +
    from great_tables import html
     from great_tables.data import sza
     import polars.selectors as cs
    @@ -790,52 +790,52 @@ 

    Bringing it all t ) )

    -
    +
    diff --git a/get-started/column-selection.html b/get-started/column-selection.html index 608746aa0..f7702a643 100644 --- a/get-started/column-selection.html +++ b/get-started/column-selection.html @@ -351,7 +351,7 @@

    Column Selection

  • a Polars selector.
  • a function that takes a string and returns True or False.
  • -
    +
    from great_tables import GT
     from great_tables.data import exibble
     
    @@ -360,52 +360,52 @@ 

    Column Selection

    gt_ex
    -
    +
    @@ -460,55 +460,55 @@

    Column Selection

    Using integers

    We can use a list of strings or integers to select columns by name or position, respectively.

    -
    +
    gt_ex.cols_move_to_start(columns=["date", 1, -1])
    -
    +
    @@ -571,7 +571,7 @@

    Using integers

    Using Polars selectors

    When using a Polars DataFrame, you can select columns using Polars selectors. The example below uses Polars selectors to move all columns that start with "c" or "f" to the start of the table.

    -
    +
    import polars as pl
     import polars.selectors as cs
     
    @@ -579,52 +579,52 @@ 

    Using Polar GT(pl_df).cols_move_to_start(columns=cs.starts_with("c") | cs.starts_with("f"))

    -
    +
    @@ -677,7 +677,7 @@

    Using Polar

    In general, selection should match the behaviors of the Polars DataFrame.select() method.

    -
    +
    pl_df.select(cs.starts_with("c") | cs.starts_with("f")).columns
    ['char', 'fctr']
    @@ -688,55 +688,55 @@

    Using Polar

    Using functions

    A function can be used to select columns. It should take a column name as a string and return True or False.

    -
    +
    gt_ex.cols_move_to_start(columns=lambda x: "c" in x)
    -
    +

    diff --git a/get-started/index.html b/get-started/index.html index ca6bcdea4..c23f5ff54 100644 --- a/get-started/index.html +++ b/get-started/index.html @@ -353,66 +353,66 @@

    Let’s Install

    A Basic Table using Great Tables

    Let’s use a subset of the islands dataset available within great_tables.data:

    -
    +
    from great_tables import GT, md, html
     from great_tables.data import islands
     
     islands_mini = islands.head(10)

    The islands data is a simple Pandas DataFrame with 2 columns and that’ll serve as a great start. Speaking of which, the main entry point into the Great Tables API is the GT class. Let’s use that to make a presentable table:

    -
    +
    # Create a display table showing ten of the largest islands in the world
     gt_tbl = GT(islands_mini)
     
     # Show the output table
     gt_tbl
    -
    +
    @@ -478,7 +478,7 @@

    A Basic T

    Polars DataFrame support

    GT accepts both Pandas and Polars DataFrames. You can pass a Polars DataFrame to GT, or use its DataFrame.style property.

    -
    +
    import polars as pl
     
     df_polars = pl.from_pandas(islands_mini)
    @@ -489,52 +489,52 @@ 

    Polars# Approach 2: Polars style property ---- df_polars.style

    -
    +

    @@ -612,7 +612,7 @@

    Polars

    Some Beautiful Examples

    In the following pages we’ll use Great Tables to turn DataFrames into beautiful tables, like the ones below.

    -
    +
    Show the Code
    from great_tables import GT, md, html
    @@ -636,52 +636,52 @@ 

    Some Beautiful Exa )

    -
    +

    @@ -759,7 +759,7 @@

    Some Beautiful Exa -
    +
    Show the Code
    from great_tables import GT, html
    @@ -787,52 +787,52 @@ 

    Some Beautiful Exa gt_airquality

    -
    +

    diff --git a/get-started/nanoplots.html b/get-started/nanoplots.html index 76ab3c264..6f1e2c631 100644 --- a/get-started/nanoplots.html +++ b/get-started/nanoplots.html @@ -369,7 +369,7 @@

    Nanoplots

    A simple line-based nanoplot

    Let’s make some simple plots with a Polars DataFrame. Here we are using lists to define data values for each cell in the numbers column. The fmt_nanoplot() method understands that these are input values for a line plot (the default type of nanoplot).

    -
    +
    from great_tables import GT
     import polars as pl
     
    @@ -387,52 +387,52 @@ 

    A simple line GT(random_numbers_df).fmt_nanoplot(columns="numbers")

    -
    +
    @@ -495,55 +495,55 @@

    A simple line

    The reference line and the reference area

    You can insert two additional things which may be useful: a reference line and a reference area. You can define them either through literal values or via keywords (these are: "mean", "median", "min", "max", "q1", "q3", "first", or "last"). Here’s a reference line that corresponds to the mean data value of each nanoplot:

    -
    +
    GT(random_numbers_df).fmt_nanoplot(columns="numbers", reference_line="mean")
    -
    +

    @@ -581,55 +581,55 @@

    This example uses a reference area that bounds the minimum value to the median value:

    -
    +
    GT(random_numbers_df).fmt_nanoplot(columns="numbers", reference_area=["min", "median"])
    -
    +

    @@ -671,55 +671,55 @@

    Using autoscale= to have a common y-axis scale across plots

    There are lots of options. Like, if you want to ensure that the scale is shared across all of the nanoplots (so you can better get a sense of overall magnitude), you can set autoscale= to True:

    -
    +
    GT(random_numbers_df).fmt_nanoplot(columns="numbers", autoscale=True)
    -
    +

    @@ -761,7 +761,7 @@

    Using the nanoplot_options() helper function

    There are many options for customization. You can radically change the look of a collection of nanoplots with the nanoplot_options() helper function. With that function, you invoke it in the options= argument of fmt_nanoplot(). You can modify the sizes and colors of different elements, decide which elements are even present, and much more! Here’s an example where a line-based nanoplot retains all of its elements, but the overall appearance is greatly altered.

    -
    +
    from great_tables import nanoplot_options
     
     (
    @@ -782,52 +782,52 @@ 

    ) )

    -
    +
    @@ -869,55 +869,55 @@

    Making nanoplots with bars using plot_type="bar"

    We don’t just support line plots in fmt_nanoplot(), we also have the option to show bar plots. The only thing you need to change is the value of plot_type= argument to "bar":

    -
    +
    GT(random_numbers_df).fmt_nanoplot(columns="numbers", plot_type="bar")
    -
    +
    @@ -956,7 +956,7 @@

    still allows us to supply a reference line and a reference area with reference_line= and reference_area=. The autoscale= option works here as well. We also have a set of options just for bar plots available inside nanoplot_options(). Here’s an example where we use all of the aforementioned customization possibilities:

    -
    +
    (
         GT(random_numbers_df)
         .fmt_nanoplot(
    @@ -979,52 +979,52 @@ 

    ) )

    -
    +

    @@ -1065,7 +1065,7 @@

    Horizontal bar and line plots

    Single-value bar plots, running in the horizontal direction, can be made by simply invoking fmt_nanoplot() on a column of numeric values. These plots are meant for comparison across rows so the method automatically scales the horizontal bars to facilitate this type of display. Here’s a simple example that uses plot_type="bar" on the numbers column that contains a single numeric value in every cell.

    -
    +
    single_vals_df = pl.DataFrame(
         {
             "example": ["Row " + str(x) for x in range(1, 5)],
    @@ -1075,52 +1075,52 @@ 

    Horizontal b GT(single_vals_df).fmt_nanoplot(columns="numbers", plot_type="bar")

    -
    +
    @@ -1158,55 +1158,55 @@

    Horizontal b

    This, interestingly enough, works with the "line" type of nanoplot. The result is akin to a lollipop plot:

    -
    +
    GT(single_vals_df).fmt_nanoplot(columns="numbers")
    -
    +

    @@ -1248,7 +1248,7 @@

    Horizontal b

    Line plots with paired x and y values

    Aside from a single stream of y values, we can plot pairs of x and y values. This works only for the "line" type of plot. We can set up a column of Polars struct values in a DataFrame to have this input data prepared for fmt_nanoplot(). Notice that the dictionary values in the enclosed list must have the "x" and "y" keys. Further to this, the list lengths for each of "x" and "y" must match (i.e., to make valid pairs of x and y).

    -
    +
    weather_2 = pl.DataFrame(
         {
             "station": ["Station " + str(x) for x in range(1, 4)],
    @@ -1283,52 +1283,52 @@ 

    Line ) )

    -
    +

    diff --git a/get-started/row-selection.html b/get-started/row-selection.html index 99f663c0a..3fb83237f 100644 --- a/get-started/row-selection.html +++ b/get-started/row-selection.html @@ -352,7 +352,7 @@

    Row Selection

  • a function that takes a DataFrame and returns a boolean Series.
  • The following sections will use a subset of the exibble data, to demonstrate these options.

    -
    +
    from great_tables import GT, exibble, loc, style
     
     lil_exibble = exibble[["num", "char", "currency"]].head(3)
    @@ -361,55 +361,55 @@ 

    Row Selection

    Using integers

    Use a single integer, or a list of integers, to select rows by position.

    -
    +
    gt_ex.fmt_currency("currency", rows=0, decimals=1)
    -
    +
    @@ -448,55 +448,55 @@

    Using integers

    Notice that a dollar sign ($) was only added to the first row (index 0 in python).

    Indexing works the same as selecting items from a python list. This negative integers select relative to the final row.

    -
    +
    gt_ex.fmt_currency("currency", rows=[0, -1], decimals=1)
    -
    +
    @@ -538,59 +538,59 @@

    Using integers

    Using polars expressions

    The rows= argument accepts polars expressions, which return a boolean Series, indicating which rows to operate on.

    For example, the code below only formats the num column, but only when currency is less than 40.

    -
    +
    import polars as pl
     
     gt_polars = GT(pl.from_pandas(lil_exibble))
     
     gt_polars.fmt_integer("num", rows=pl.col("currency") < 40)
    -
    +
    @@ -628,7 +628,7 @@

    Using polars expr

    Here’s a more realistic example, which highlights the row with the highest value for currency.

    -
    +
    import polars.selectors as cs
     
     gt_polars.tab_style(
    @@ -639,52 +639,52 @@ 

    Using polars expr ) )

    -
    +

    @@ -726,55 +726,55 @@

    Using polars expr

    Using a function

    Since libraries like pandas don’t have lazy expressions, the rows= argument also accepts a function for selecting rows. The function should take a DataFrame and return a boolean series.

    Here’s the same example as the previous polars section, but with pandas data, and a lamba for selecting rows.

    -
    +
    gt_ex.fmt_integer("num", rows=lambda D: D["currency"] < 40)
    -
    +
    @@ -812,7 +812,7 @@

    Using a function

    Here’s the styling example from the previous polars section.

    -
    +
    import polars.selectors as cs
     
     gt_ex.tab_style(
    @@ -823,52 +823,52 @@ 

    Using a function

    ) )
    -
    +
    diff --git a/get-started/table-theme-options.html b/get-started/table-theme-options.html index dcad53808..5cc406efb 100644 --- a/get-started/table-theme-options.html +++ b/get-started/table-theme-options.html @@ -355,7 +355,7 @@

    Table Theme Options

    This page covers how to style and theme your table using GT.tab_options(), which is meant to quickly set a broad range of styles. In the future, even more granular options will become available via GT.tab_style().

    We’ll use the basic GT object below for most examples, since it marks some of the table parts.

    -
    +
    from great_tables import GT, exibble
     
     gt_ex = (
    @@ -367,52 +367,52 @@ 

    Table Theme Options

    gt_ex
    -
    +
    @@ -511,7 +511,7 @@

    Table Theme Options

    Table option parts

    As the graph above showed, tables are made of many parts—such as the heading, column labels, and stub. .tab_options() organizes options based on table part.

    The code below illustrates the table parts .tab_options() can target, by setting the background color for various parts.

    -
    +
    (
         gt_ex
         .tab_options(
    @@ -525,52 +525,52 @@ 

    Table option parts

    ) )
    -
    +
    @@ -704,59 +704,59 @@

    Findin

    Styling borders

    Many table parts support customizing border colors and style. This is shown below for column labels.

    -
    +
    gt_ex.tab_options(
         column_labels_border_top_color="blue",
         column_labels_border_top_style="solid",
         column_labels_border_top_width="5px"
     )
    -
    +

    @@ -854,57 +854,57 @@

    Styling borders

    Styling background color

    -
    +
    gt_ex.tab_options(
         heading_background_color="purple"
     )
    -
    +
    @@ -1004,59 +1004,59 @@

    Styling backgroun

    Styling body cells

    The table body can style the lines between individual cells. Use the hline and vline option types to specify cell line color, style, and width.

    For example, the code below changes horizontal lines (hline) between cells to be red, dashed lines.

    -
    +
    gt_ex.tab_options(
         table_body_hlines_color="red",
         table_body_hlines_style="dashed",
         table_body_hlines_width="4px",
     )
    -
    +
    @@ -1152,58 +1152,58 @@

    Styling body cells

    In order to define the vertical lines between cells, set vline styles. For example, the code below makes both horizontal and vertical lines between cells solid.

    -
    +
    gt_ex.tab_options(
         table_body_hlines_style="solid",
         table_body_vlines_style="solid",
     )
    -
    +
    @@ -1302,7 +1302,7 @@

    Styling body cells

    Set options across table parts

    Some options starting with table_ apply to all parts of the table. For example, fonts and background color apply everywhere.

    -
    +
    gt_ex.tab_options(
         table_background_color="green",
         table_font_color="darkblue",
    @@ -1310,52 +1310,52 @@ 

    Set options table_font_names="Times New Roman" )

    -
    +
    @@ -1451,58 +1451,58 @@

    Set options

    Options set across the whole table, can be overriden by styling a specific part.

    -
    +
    gt_ex.tab_options(
         table_background_color="orange",
         heading_background_color="pink"
     )
    -
    +

    @@ -1602,7 +1602,7 @@

    Set options

    A basic theme

    Based on the sections above, we can design an overall theme for a table.

    This requires setting a decent number of options, but makes a big difference when presenting a table! Below is a table with a simple, blue theme. (The code is hidden by default, but can be expanded to see all the options set).

    -
    +
    Code
    from great_tables import GT, exibble
    @@ -1649,52 +1649,52 @@ 

    A basic theme

    )
    -
    +
    diff --git a/get-started/table-theme-premade.html b/get-started/table-theme-premade.html index 345cc6933..585e84b34 100644 --- a/get-started/table-theme-premade.html +++ b/get-started/table-theme-premade.html @@ -354,7 +354,7 @@

    Premade Themes

  • The remaining GT.opt_*() methods: shortcuts for common uses of GT.tab_options().
  • We’ll use the basic GT object below for most examples, since it marks some of the table parts.

    -
    +
    from great_tables import GT, exibble, md
     
     lil_exibble = exibble.head(5)[["num", "char", "row", "group"]]
    @@ -374,52 +374,52 @@ 

    Premade Themes

    gt_ex
    -
    +
    @@ -489,55 +489,55 @@

    opt_styli

    Below are the first two premade styles. The first uses color="blue", and the second uses color="red".

    -
    +
    gt_ex.opt_stylize(style=1, color="blue")
    -
    +

    @@ -604,55 +604,55 @@

    opt_styli
    -
    +
    gt_ex.opt_stylize(style=2, color="red")
    -
    +

    @@ -731,52 +731,52 @@

    opt_styli
    1
    -
    +

    @@ -884,52 +884,52 @@

    opt_styli
    2
    -
    +

    @@ -1037,52 +1037,52 @@

    opt_styli
    3
    -
    +

    @@ -1190,52 +1190,52 @@

    opt_styli
    4
    -
    +

    @@ -1343,52 +1343,52 @@

    opt_styli
    5
    -
    +

    @@ -1496,52 +1496,52 @@

    opt_styli
    6
    -
    +

    @@ -1652,55 +1652,55 @@

    opt_*()This section shows the different GT.opt_*() methods available. They serve as convenience methods for common GT.tab_options() tasks.

    Align table header

    -
    +
    gt_ex.opt_align_table_header(align="left")
    -
    +

    @@ -1768,55 +1768,55 @@

    Align table header

    Make text ALL CAPS

    -
    +
    gt_ex.opt_all_caps()
    -
    +
    @@ -1884,55 +1884,55 @@

    Make text ALL CAPS

    Reduce or expand padding

    -
    +
    gt_ex.opt_vertical_padding(scale=0.3)
    -
    +
    @@ -1997,55 +1997,55 @@

    Reduce or expand -
    +
    gt_ex.opt_horizontal_padding(scale=3)
    -
    +

    @@ -2113,55 +2113,55 @@

    Reduce or expand

    Set table outline

    -
    +
    gt_ex.opt_table_outline()
    -
    +

    diff --git a/get-started/targeted-styles.html b/get-started/targeted-styles.html index 0d3212679..e05f3177d 100644 --- a/get-started/targeted-styles.html +++ b/get-started/targeted-styles.html @@ -362,7 +362,7 @@

    Targeted styles

    Kitchen sink

    Below is a big example that shows all possible loc specifiers being used.

    -
    +
    from great_tables import GT, exibble, loc, style
     
     # https://colorbrewer2.org/#type=qualitative&scheme=Paired&n=12
    @@ -413,52 +413,52 @@ 

    Kitchen sink

    .tab_style(style.fill(next(c)), loc.stubhead()) )
    -
    +
    @@ -525,55 +525,55 @@

    Kitchen sink

    Body

    -
    +
    gt.tab_style(style.fill("yellow"), loc.body())
    -
    +
    @@ -640,7 +640,7 @@

    Body

    Column labels

    -
    +
    (
         gt
         .tab_style(style.fill("yellow"), loc.column_header())
    @@ -648,52 +648,52 @@ 

    Column labels

    .tab_style(style.fill("red"), loc.spanner_labels(ids=["spanner"])) )
    -
    +
    @@ -760,59 +760,59 @@

    Column labels

    @@ -879,7 +879,7 @@

    Header

    @@ -1002,7 +1002,7 @@

    Footer

    Stub

    -
    +
    (
         gt.tab_style(style.fill("yellow"), loc.stub())
         .tab_style(style.fill("blue"), loc.row_groups())
    @@ -1012,52 +1012,52 @@ 

    Stub

    ) )
    -
    +
    @@ -1124,55 +1124,55 @@

    Stub

    Stubhead

    -
    +
    gt.tab_style(style.fill("yellow"), loc.stubhead())
    -
    +
    diff --git a/reference/GT.as_raw_html.html b/reference/GT.as_raw_html.html index 800b24934..441c6cc41 100644 --- a/reference/GT.as_raw_html.html +++ b/reference/GT.as_raw_html.html @@ -247,12 +247,12 @@

    Returns

    Examples:

    Let’s use the row column of exibble dataset to create a table. With the as_raw_html() method, we’re able to output the HTML content.

    -
    +
    from great_tables import GT, exibble
     
     GT(exibble[["row"]]).as_raw_html()
    -
    '<div id="rlonmggyup" style="padding-left:0px;padding-right:0px;padding-top:10px;padding-bottom:10px;overflow-x:auto;overflow-y:auto;width:auto;height:auto;">\n<style>\n#rlonmggyup table {\n          font-family: -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, Oxygen, Ubuntu, Cantarell, \'Helvetica Neue\', \'Fira Sans\', \'Droid Sans\', Arial, sans-serif;\n          -webkit-font-smoothing: antialiased;\n          -moz-osx-font-smoothing: grayscale;\n        }\n\n#rlonmggyup thead, tbody, tfoot, tr, td, th { border-style: none; }\n tr { background-color: transparent; }\n#rlonmggyup p { margin: 0; padding: 0; }\n #rlonmggyup .gt_table { display: table; border-collapse: collapse; line-height: normal; margin-left: auto; margin-right: auto; color: #333333; font-size: 16px; font-weight: normal; font-style: normal; background-color: #FFFFFF; width: auto; border-top-style: solid; border-top-width: 2px; border-top-color: #A8A8A8; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #A8A8A8; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; }\n #rlonmggyup .gt_caption { padding-top: 4px; padding-bottom: 4px; }\n #rlonmggyup .gt_title { color: #333333; font-size: 125%; font-weight: initial; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; border-bottom-color: #FFFFFF; border-bottom-width: 0; }\n #rlonmggyup .gt_subtitle { color: #333333; font-size: 85%; font-weight: initial; padding-top: 3px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; border-top-color: #FFFFFF; border-top-width: 0; }\n #rlonmggyup .gt_heading { background-color: #FFFFFF; text-align: center; border-bottom-color: #FFFFFF; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; }\n #rlonmggyup .gt_bottom_border { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }\n #rlonmggyup .gt_col_headings { border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; }\n #rlonmggyup .gt_col_heading { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: normal; text-transform: inherit; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: bottom; padding-top: 5px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; overflow-x: hidden; }\n #rlonmggyup .gt_column_spanner_outer { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: normal; text-transform: inherit; padding-top: 0; padding-bottom: 0; padding-left: 4px; padding-right: 4px; }\n #rlonmggyup .gt_column_spanner_outer:first-child { padding-left: 0; }\n #rlonmggyup .gt_column_spanner_outer:last-child { padding-right: 0; }\n #rlonmggyup .gt_column_spanner { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; vertical-align: bottom; padding-top: 5px; padding-bottom: 5px; overflow-x: hidden; display: inline-block; width: 100%; }\n #rlonmggyup .gt_spanner_row { border-bottom-style: hidden; }\n #rlonmggyup .gt_group_heading { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: middle; text-align: left; }\n #rlonmggyup .gt_empty_group_heading { padding: 0.5px; color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; vertical-align: middle; }\n #rlonmggyup .gt_from_md> :first-child { margin-top: 0; }\n #rlonmggyup .gt_from_md> :last-child { margin-bottom: 0; }\n #rlonmggyup .gt_row { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; margin: 10px; border-top-style: solid; border-top-width: 1px; border-top-color: #D3D3D3; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: middle; overflow-x: hidden; }\n #rlonmggyup .gt_stub { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-right-style: solid; border-right-width: 2px; border-right-color: #D3D3D3; padding-left: 5px; padding-right: 5px; }\n #rlonmggyup .gt_stub_row_group { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-right-style: solid; border-right-width: 2px; border-right-color: #D3D3D3; padding-left: 5px; padding-right: 5px; vertical-align: top; }\n #rlonmggyup .gt_row_group_first td { border-top-width: 2px; }\n #rlonmggyup .gt_row_group_first th { border-top-width: 2px; }\n #rlonmggyup .gt_striped { background-color: rgba(128,128,128,0.05); }\n #rlonmggyup .gt_table_body { border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }\n #rlonmggyup .gt_sourcenotes { color: #333333; background-color: #FFFFFF; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; }\n #rlonmggyup .gt_sourcenote { font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; text-align: left; }\n #rlonmggyup .gt_left { text-align: left; }\n #rlonmggyup .gt_center { text-align: center; }\n #rlonmggyup .gt_right { text-align: right; font-variant-numeric: tabular-nums; }\n #rlonmggyup .gt_font_normal { font-weight: normal; }\n #rlonmggyup .gt_font_bold { font-weight: bold; }\n #rlonmggyup .gt_font_italic { font-style: italic; }\n #rlonmggyup .gt_super { font-size: 65%; }\n #rlonmggyup .gt_footnote_marks { font-size: 75%; vertical-align: 0.4em; position: initial; }\n #rlonmggyup .gt_asterisk { font-size: 100%; vertical-align: 0; }\n \n</style>\n<table class="gt_table" data-quarto-disable-processing="false" data-quarto-bootstrap="false">\n<thead>\n\n<tr class="gt_col_headings">\n  <th class="gt_col_heading gt_columns_bottom_border gt_left" rowspan="1" colspan="1" scope="col" id="row">row</th>\n</tr>\n</thead>\n<tbody class="gt_table_body">\n  <tr>\n    <td class="gt_row gt_left">row_1</td>\n  </tr>\n  <tr>\n    <td class="gt_row gt_left">row_2</td>\n  </tr>\n  <tr>\n    <td class="gt_row gt_left">row_3</td>\n  </tr>\n  <tr>\n    <td class="gt_row gt_left">row_4</td>\n  </tr>\n  <tr>\n    <td class="gt_row gt_left">row_5</td>\n  </tr>\n  <tr>\n    <td class="gt_row gt_left">row_6</td>\n  </tr>\n  <tr>\n    <td class="gt_row gt_left">row_7</td>\n  </tr>\n  <tr>\n    <td class="gt_row gt_left">row_8</td>\n  </tr>\n</tbody>\n\n\n</table>\n\n</div>\n        '
    +
    '<div id="nafnqvtxlv" style="padding-left:0px;padding-right:0px;padding-top:10px;padding-bottom:10px;overflow-x:auto;overflow-y:auto;width:auto;height:auto;">\n<style>\n#nafnqvtxlv table {\n          font-family: -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, Oxygen, Ubuntu, Cantarell, \'Helvetica Neue\', \'Fira Sans\', \'Droid Sans\', Arial, sans-serif;\n          -webkit-font-smoothing: antialiased;\n          -moz-osx-font-smoothing: grayscale;\n        }\n\n#nafnqvtxlv thead, tbody, tfoot, tr, td, th { border-style: none; }\n tr { background-color: transparent; }\n#nafnqvtxlv p { margin: 0; padding: 0; }\n #nafnqvtxlv .gt_table { display: table; border-collapse: collapse; line-height: normal; margin-left: auto; margin-right: auto; color: #333333; font-size: 16px; font-weight: normal; font-style: normal; background-color: #FFFFFF; width: auto; border-top-style: solid; border-top-width: 2px; border-top-color: #A8A8A8; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #A8A8A8; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; }\n #nafnqvtxlv .gt_caption { padding-top: 4px; padding-bottom: 4px; }\n #nafnqvtxlv .gt_title { color: #333333; font-size: 125%; font-weight: initial; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; border-bottom-color: #FFFFFF; border-bottom-width: 0; }\n #nafnqvtxlv .gt_subtitle { color: #333333; font-size: 85%; font-weight: initial; padding-top: 3px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; border-top-color: #FFFFFF; border-top-width: 0; }\n #nafnqvtxlv .gt_heading { background-color: #FFFFFF; text-align: center; border-bottom-color: #FFFFFF; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; }\n #nafnqvtxlv .gt_bottom_border { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }\n #nafnqvtxlv .gt_col_headings { border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; }\n #nafnqvtxlv .gt_col_heading { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: normal; text-transform: inherit; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: bottom; padding-top: 5px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; overflow-x: hidden; }\n #nafnqvtxlv .gt_column_spanner_outer { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: normal; text-transform: inherit; padding-top: 0; padding-bottom: 0; padding-left: 4px; padding-right: 4px; }\n #nafnqvtxlv .gt_column_spanner_outer:first-child { padding-left: 0; }\n #nafnqvtxlv .gt_column_spanner_outer:last-child { padding-right: 0; }\n #nafnqvtxlv .gt_column_spanner { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; vertical-align: bottom; padding-top: 5px; padding-bottom: 5px; overflow-x: hidden; display: inline-block; width: 100%; }\n #nafnqvtxlv .gt_spanner_row { border-bottom-style: hidden; }\n #nafnqvtxlv .gt_group_heading { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: middle; text-align: left; }\n #nafnqvtxlv .gt_empty_group_heading { padding: 0.5px; color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; vertical-align: middle; }\n #nafnqvtxlv .gt_from_md> :first-child { margin-top: 0; }\n #nafnqvtxlv .gt_from_md> :last-child { margin-bottom: 0; }\n #nafnqvtxlv .gt_row { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; margin: 10px; border-top-style: solid; border-top-width: 1px; border-top-color: #D3D3D3; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: middle; overflow-x: hidden; }\n #nafnqvtxlv .gt_stub { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-right-style: solid; border-right-width: 2px; border-right-color: #D3D3D3; padding-left: 5px; padding-right: 5px; }\n #nafnqvtxlv .gt_stub_row_group { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-right-style: solid; border-right-width: 2px; border-right-color: #D3D3D3; padding-left: 5px; padding-right: 5px; vertical-align: top; }\n #nafnqvtxlv .gt_row_group_first td { border-top-width: 2px; }\n #nafnqvtxlv .gt_row_group_first th { border-top-width: 2px; }\n #nafnqvtxlv .gt_striped { background-color: rgba(128,128,128,0.05); }\n #nafnqvtxlv .gt_table_body { border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }\n #nafnqvtxlv .gt_sourcenotes { color: #333333; background-color: #FFFFFF; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; }\n #nafnqvtxlv .gt_sourcenote { font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; text-align: left; }\n #nafnqvtxlv .gt_left { text-align: left; }\n #nafnqvtxlv .gt_center { text-align: center; }\n #nafnqvtxlv .gt_right { text-align: right; font-variant-numeric: tabular-nums; }\n #nafnqvtxlv .gt_font_normal { font-weight: normal; }\n #nafnqvtxlv .gt_font_bold { font-weight: bold; }\n #nafnqvtxlv .gt_font_italic { font-style: italic; }\n #nafnqvtxlv .gt_super { font-size: 65%; }\n #nafnqvtxlv .gt_footnote_marks { font-size: 75%; vertical-align: 0.4em; position: initial; }\n #nafnqvtxlv .gt_asterisk { font-size: 100%; vertical-align: 0; }\n \n</style>\n<table class="gt_table" data-quarto-disable-processing="false" data-quarto-bootstrap="false">\n<thead>\n\n<tr class="gt_col_headings">\n  <th class="gt_col_heading gt_columns_bottom_border gt_left" rowspan="1" colspan="1" scope="col" id="row">row</th>\n</tr>\n</thead>\n<tbody class="gt_table_body">\n  <tr>\n    <td class="gt_row gt_left">row_1</td>\n  </tr>\n  <tr>\n    <td class="gt_row gt_left">row_2</td>\n  </tr>\n  <tr>\n    <td class="gt_row gt_left">row_3</td>\n  </tr>\n  <tr>\n    <td class="gt_row gt_left">row_4</td>\n  </tr>\n  <tr>\n    <td class="gt_row gt_left">row_5</td>\n  </tr>\n  <tr>\n    <td class="gt_row gt_left">row_6</td>\n  </tr>\n  <tr>\n    <td class="gt_row gt_left">row_7</td>\n  </tr>\n  <tr>\n    <td class="gt_row gt_left">row_8</td>\n  </tr>\n</tbody>\n\n\n</table>\n\n</div>\n        '
    diff --git a/reference/GT.cols_align.html b/reference/GT.cols_align.html index 0882442f5..52eb86f46 100644 --- a/reference/GT.cols_align.html +++ b/reference/GT.cols_align.html @@ -262,7 +262,7 @@

    Returns

    Examples

    Let’s use the countrypops to create a small table. We can change the alignment of the population column with cols_align(). In this example, the column label and body cells of population will be aligned to the left.

    -
    +
    from great_tables import GT
     from great_tables.data import countrypops
     
    @@ -275,52 +275,52 @@ 

    Examples

    .cols_align(align="left", columns="population") )
    -
    +
    diff --git a/reference/GT.cols_hide.html b/reference/GT.cols_hide.html index f4974a18a..a020efc0e 100644 --- a/reference/GT.cols_hide.html +++ b/reference/GT.cols_hide.html @@ -257,7 +257,7 @@

    Returns

    Examples

    For this example, we’ll use a portion of the countrypops dataset to create a simple table. Let’s hide the year column with the cols_hide() method.

    -
    +
    from great_tables import GT
     from great_tables.data import countrypops
     
    @@ -267,52 +267,52 @@ 

    Examples

    GT(countrypops_mini).cols_hide(columns="year")
    -
    +
    diff --git a/reference/GT.cols_label.html b/reference/GT.cols_label.html index d2f8dc65a..ea417f1f4 100644 --- a/reference/GT.cols_label.html +++ b/reference/GT.cols_label.html @@ -267,7 +267,7 @@

    Notes

    Examples

    The example below relabels columns from the countrypops data to start with uppercase.

    -
    +
    from great_tables import GT
     from great_tables.data import countrypops
     
    @@ -284,52 +284,52 @@ 

    Examples

    ) )
    -
    +
    @@ -378,7 +378,7 @@

    Examples

    Note that we supplied the name of the column as the key, and the new label as the value.

    We can also use Markdown formatting for the column labels. In this example, we’ll use md("*Population*") to make the label italicized.

    -
    +
    from great_tables import GT, md
     from great_tables.data import countrypops
     
    @@ -391,52 +391,52 @@ 

    Examples

    ) )
    -
    +
    @@ -484,7 +484,7 @@

    Examples

    We can also use unit notation to format the column labels. In this example, we’ll use {cm^3 molecules^-1 s^-1} for part of the label for the OH_k298 column.

    -
    +
    from great_tables import GT
     from great_tables.data import reactions
     import polars as pl
    @@ -505,52 +505,52 @@ 

    Examples

    ) )
    -
    +
    diff --git a/reference/GT.cols_move.html b/reference/GT.cols_move.html index 1bb3869b7..8a58f4380 100644 --- a/reference/GT.cols_move.html +++ b/reference/GT.cols_move.html @@ -263,7 +263,7 @@

    Returns

    Examples

    Let’s use the countrypops dataset to create a table. We’ll choose to position the population column after the country_name column by using the cols_move() method.

    -
    +
    from great_tables import GT
     from great_tables.data import countrypops
     
    @@ -279,52 +279,52 @@ 

    Examples

    ) )
    -
    +
    diff --git a/reference/GT.cols_move_to_end.html b/reference/GT.cols_move_to_end.html index ddd7c91d6..448779268 100644 --- a/reference/GT.cols_move_to_end.html +++ b/reference/GT.cols_move_to_end.html @@ -256,7 +256,7 @@

    Returns

    Examples

    For this example, we’ll use a portion of the countrypops dataset to create a simple table. Let’s move the year column, which is the middle column, to the end of the column series with the cols_move_to_end() method.

    -
    +
    from great_tables import GT
     from great_tables.data import countrypops
     
    @@ -266,52 +266,52 @@ 

    Examples

    GT(countrypops_mini).cols_move_to_end(columns="year")
    -
    +
    @@ -359,55 +359,55 @@

    Examples

    We can also move multiple columns at a time. With the same countrypops-based table (countrypops_mini), let’s move both the year and country_name columns to the end of the column series.

    -
    +
    GT(countrypops_mini).cols_move_to_end(columns=["year", "country_name"])
    -
    +
    diff --git a/reference/GT.cols_move_to_start.html b/reference/GT.cols_move_to_start.html index 74d8bdb35..fd2168bd3 100644 --- a/reference/GT.cols_move_to_start.html +++ b/reference/GT.cols_move_to_start.html @@ -257,7 +257,7 @@

    Returns

    Examples

    For this example, we’ll use a portion of the countrypops dataset to create a simple table. Let’s move the year column, which is the middle column, to the start of the column series with the cols_move_to_start() method.

    -
    +
    from great_tables import GT
     from great_tables.data import countrypops
     
    @@ -267,52 +267,52 @@ 

    Examples

    GT(countrypops_mini).cols_move_to_start(columns="year")
    -
    +
    @@ -360,55 +360,55 @@

    Examples

    We can also move multiple columns at a time. With the same countrypops-based table (countrypops_mini), let’s move both the year and population columns to the start of the column series.

    -
    +
    GT(countrypops_mini).cols_move_to_start(columns=["year", "population"])
    -
    +
    diff --git a/reference/GT.cols_width.html b/reference/GT.cols_width.html index e9fd58870..e6a60d63e 100644 --- a/reference/GT.cols_width.html +++ b/reference/GT.cols_width.html @@ -262,7 +262,7 @@

    Returns

    Examples

    Let’s use select columns from the exibble dataset to create a new table. We can specify the widths of columns with cols_width(). This is done by specifying the exact widths for table columns in a dictionary. In this example, we’ll set the width of the num column to "150px", the char column to "100px", the date column to "300px". All other columns won’t be affected (their widths will be automatically set by their content).

    -
    +
    from great_tables import GT, exibble
     
     exibble_mini = exibble[["num", "char", "date", "datetime", "row"]].head(5)
    @@ -278,52 +278,52 @@ 

    Examples

    ) )
    -
    +
    @@ -391,7 +391,7 @@

    Examples

    We can also specify the widths of columns as percentages. In this example, we’ll set the width of the num column to "20%", the char column to "10%", and the date column to "30%". Note that the percentages are relative and don’t need to sum to 100%.

    -
    +
    (
         GT(exibble_mini)
         .cols_width(
    @@ -403,52 +403,52 @@ 

    Examples

    ) )
    -
    +
    @@ -516,7 +516,7 @@

    Examples

    We can also mix and match pixel and percentage widths. In this example, we’ll set the width of the num column to "150px", the char column to "10%", and the date column to "30%".

    -
    +
    (
         GT(exibble_mini)
         .cols_width(
    @@ -528,52 +528,52 @@ 

    Examples

    ) )
    -
    +
    @@ -641,7 +641,7 @@

    Examples

    If we set the width of all columns, the table will be forced to use the specified widths (i.e., a column width less than the content width will be honored). In this next example, we’ll set widths for all columns. This is a good way to ensure that the widths you specify are fully respected (and not overridden by automatic width calculations).

    -
    +
    (
         GT(exibble_mini)
         .cols_width(
    @@ -655,52 +655,52 @@ 

    Examples

    ) )
    -
    +
    diff --git a/reference/GT.data_color.html b/reference/GT.data_color.html index 342192d55..9cd25cec8 100644 --- a/reference/GT.data_color.html +++ b/reference/GT.data_color.html @@ -568,58 +568,58 @@

    Examples

    The data_color() method can be used without any supplied arguments to colorize a table. Let’s do this with the exibble dataset:

    -
    +
    from great_tables import GT
     from great_tables.data import exibble
     
     GT(exibble).data_color()
    -
    +
    @@ -737,58 +737,58 @@

    Examples

    What’s happened is that data_color() applies background colors to all cells of every column with the palette of eight colors. Numeric columns will use ‘numeric’ methodology for color scaling whereas string-based columns will use the ‘factor’ methodology. The text color undergoes an automatic modification that maximizes contrast (since autocolor_text=True by default).

    We can target specific colors and apply color to just those columns. Let’s do that and also supply palette= values of "red" and "green".

    -
    +
    GT(exibble).data_color(
         columns=["num", "currency"],
         palette=["red", "green"]
     )
    -
    +
    @@ -906,7 +906,7 @@

    Examples

    With those options in place we see that only the numeric columns num and currency received color treatments. Moreover, the palette colors were mapped to the lower and upper limits of the data in each column; interpolated colors were used for the values in between the numeric limits of the two columns.

    We can manually set the limits of the data with the domain= argument (which is preferable in most cases). Let’s colorize just the currency column and set domain=[0, 50]. Any values that are either missing or lie outside of the domain will be colorized with the na_color= color (so we’ll set that to "lightgray").

    -
    +
    GT(exibble).data_color(
         columns="currency",
         palette=["red", "green"],
    @@ -914,52 +914,52 @@ 

    Examples

    na_color="lightgray" )
    -
    +
    diff --git a/reference/GT.fmt.html b/reference/GT.fmt.html index 94bbe4d92..3eba060a8 100644 --- a/reference/GT.fmt.html +++ b/reference/GT.fmt.html @@ -275,7 +275,7 @@

    Returns

    Examples

    Let’s use the exibble dataset to create a table. With the fmt() method, we’ll add a prefix ^ and a suffix $ to the row and group columns.

    -
    +
    from great_tables import GT, exibble
     
     (
    @@ -283,52 +283,52 @@ 

    Examples

    .fmt(lambda x: f"^{x}$", columns=["row", "group"]) )
    -
    +
    diff --git a/reference/GT.fmt_bytes.html b/reference/GT.fmt_bytes.html index 50bf1664e..d8136cd36 100644 --- a/reference/GT.fmt_bytes.html +++ b/reference/GT.fmt_bytes.html @@ -341,7 +341,7 @@

    Adapt

    Examples

    Let’s use a single column from the exibble dataset and create a new table. We’ll format the num column to display as byte sizes in the decimal standard through use of the fmt_bytes() method.

    -
    +
    from great_tables import GT, exibble
     
     (
    @@ -349,52 +349,52 @@ 

    Examples

    .fmt_bytes(columns="num", standard="decimal") )
    -
    +

    diff --git a/reference/GT.fmt_currency.html b/reference/GT.fmt_currency.html index e8c7c7758..71269b412 100644 --- a/reference/GT.fmt_currency.html +++ b/reference/GT.fmt_currency.html @@ -356,7 +356,7 @@

    Adapt

    Examples

    Let’s use the exibble dataset to create a table. With the fmt_currency() method, we’ll format the currency column to display monetary values.

    -
    +
    from great_tables import GT, exibble
     
     (
    @@ -368,52 +368,52 @@ 

    Examples

    ) )
    -
    +

    diff --git a/reference/GT.fmt_date.html b/reference/GT.fmt_date.html index 79f96a74f..15f17a6f5 100644 --- a/reference/GT.fmt_date.html +++ b/reference/GT.fmt_date.html @@ -388,7 +388,7 @@

    Adapt

    Examples

    Let’s use the exibble dataset to create a simple, two-column table (keeping only the date and time columns). With the fmt_date() method, we’ll format the date column to display dates formatted with the "month_day_year" date style.

    -
    +
    from great_tables import GT, exibble
     
     exibble_mini = exibble[["date", "time"]]
    @@ -398,52 +398,52 @@ 

    Examples

    .fmt_date(columns="date", date_style="month_day_year") )
    -
    +

    diff --git a/reference/GT.fmt_datetime.html b/reference/GT.fmt_datetime.html index 4d5176bea..149e7020a 100644 --- a/reference/GT.fmt_datetime.html +++ b/reference/GT.fmt_datetime.html @@ -419,7 +419,7 @@

    Returns

    Examples

    Let’s use the exibble dataset to create a simple, two-column table (keeping only the date and time columns). With the fmt_datetime() method, we’ll format the date column to display dates formatted with the "month_day_year" date style and the time column to display times formatted with the "h_m_s_p" time style.

    -
    +
    from great_tables import GT, exibble
     
     exibble_mini = exibble[["date", "time"]]
    @@ -433,52 +433,52 @@ 

    Examples

    ) )
    -
    +
    diff --git a/reference/GT.fmt_image.html b/reference/GT.fmt_image.html index 4883cfa20..9b6982773 100644 --- a/reference/GT.fmt_image.html +++ b/reference/GT.fmt_image.html @@ -298,7 +298,7 @@

    Returns

    Examples

    Using a small portion of metro dataset, let’s create a new table. We will only include a few columns and rows from that table. The lines column has comma-separated listings of numbers corresponding to lines served at each station. We have a directory of SVG graphics for all of these lines in the package (the path for the image directory can be accessed via files("great_tables") / "data/metro_images", using the importlib_resources package). The filenames roughly corresponds to the data in the lines column. The fmt_image() method can be used with these inputs since the path= and file_pattern= arguments allow us to compose complete and valid file locations. What you get from this are sequences of images in the table cells, taken from the referenced graphics files on disk.

    -
    +
    from great_tables import GT
     from great_tables.data import metro
     from importlib_resources import files
    @@ -317,52 +317,52 @@ 

    Examples

    .fmt_integer(columns="passengers") )
    -
    +
    diff --git a/reference/GT.fmt_integer.html b/reference/GT.fmt_integer.html index 5bc990485..f615f231c 100644 --- a/reference/GT.fmt_integer.html +++ b/reference/GT.fmt_integer.html @@ -319,7 +319,7 @@

    Adapt

    Examples

    For this example, we’ll use the exibble dataset as the input table. With the fmt_integer() method, we’ll format the num column as integer values having no digit separators (with the use_seps=False option).

    -
    +
    from great_tables import GT, exibble
     
     (
    @@ -327,52 +327,52 @@ 

    Examples

    .fmt_integer(columns="num", use_seps=False) )
    -
    +

    diff --git a/reference/GT.fmt_markdown.html b/reference/GT.fmt_markdown.html index a5331b5fe..67092ef77 100644 --- a/reference/GT.fmt_markdown.html +++ b/reference/GT.fmt_markdown.html @@ -263,7 +263,7 @@

    Returns

    Examples:

    Let’s first create a DataFrame containing some text that is Markdown-formatted and then introduce that to GT(). We’ll then transform the md column with the fmt_markdown() method.

    -
    +
    import pandas as pd
     from great_tables import GT
     from great_tables.data import towny
    @@ -287,52 +287,52 @@ 

    Examples:

    (GT(df).fmt_markdown("md"))
    -
    +
    diff --git a/reference/GT.fmt_nanoplot.html b/reference/GT.fmt_nanoplot.html index f7840f2c9..9bdab8129 100644 --- a/reference/GT.fmt_nanoplot.html +++ b/reference/GT.fmt_nanoplot.html @@ -329,7 +329,7 @@

    Details

    Examples

    Let’s create a nanoplot from a Polars DataFrame containing multiple numbers per cell. The numbers are represented here as strings, where spaces separate the values, and the same values are present in two columns: lines and bars. We will use the fmt_nanoplot() method twice to create a line plot and a bar plot from the data in their respective columns.

    -
    +
    from great_tables import GT
     import polars as pl
     
    @@ -351,52 +351,52 @@ 

    Examples

    .fmt_nanoplot(columns="bars", plot_type="bar") )
    -
    +
    @@ -439,7 +439,7 @@

    Examples

    We can always represent the input DataFrame in a different way (with list columns) and fmt_nanoplot() will still work. While the input data is the same as in the previous example, we’ll take the opportunity here to add a reference line and a reference area to the line plot and also to the bar plot.

    -
    +
    random_numbers_df = pl.DataFrame(
         {
             "i": range(1, 5),
    @@ -466,52 +466,52 @@ 

    Examples

    reference_area=["max", "median"]) )
    -
    +
    @@ -554,7 +554,7 @@

    Examples

    Here’s an example to adjust some of the options using nanoplot_options().

    -
    +
    from great_tables import nanoplot_options
     
     (
    @@ -594,52 +594,52 @@ 

    Examples

    ) )
    -
    +
    @@ -682,7 +682,7 @@

    Examples

    Single-value bar plots and line plots can be made with fmt_nanoplot(). These run in the horizontal direction, which is ideal for tabular presentation. The key thing here is that fmt_nanoplot() expects a column of numeric values. These plots are meant for comparison across rows so the method automatically scales the horizontal bars to facilitate this type of display. The following example shows how fmt_nanoplot() can be used to create single-value bar and line plots.

    -
    +
    single_vals_df = pl.DataFrame(
         {
             "i": range(1, 6),
    @@ -696,52 +696,52 @@ 

    Examples

    .fmt_nanoplot(columns="lines", plot_type="line") )
    -
    +
    diff --git a/reference/GT.fmt_number.html b/reference/GT.fmt_number.html index 9983c954b..b2bcd743f 100644 --- a/reference/GT.fmt_number.html +++ b/reference/GT.fmt_number.html @@ -343,7 +343,7 @@

    Adapt

    Examples

    Let’s use the exibble dataset to create a table. With the fmt_number() method, we’ll format the num column to have three decimal places (with decimals=3) and omit the use of digit separators (with use_seps=False).

    -
    +
    from great_tables import GT, exibble
     
     (
    @@ -351,52 +351,52 @@ 

    Examples

    .fmt_number(columns="num", decimals=3, use_seps=False) )
    -
    +

    diff --git a/reference/GT.fmt_percent.html b/reference/GT.fmt_percent.html index 89a129ed6..98544026e 100644 --- a/reference/GT.fmt_percent.html +++ b/reference/GT.fmt_percent.html @@ -349,7 +349,7 @@

    Adapt

    Examples

    Let’s use the towny dataset as the input table. With the fmt_percent() method, we’ll format the pop_change_2016_2021_pct column to to display values as percentages (to two decimal places).

    -
    +
    from great_tables import GT
     from great_tables.data import towny
     
    @@ -360,52 +360,52 @@ 

    Examples

    (GT(towny_mini).fmt_percent("pop_change_2016_2021_pct", decimals=2))
    -
    +

    diff --git a/reference/GT.fmt_roman.html b/reference/GT.fmt_roman.html index a14833dcb..b9424aa59 100644 --- a/reference/GT.fmt_roman.html +++ b/reference/GT.fmt_roman.html @@ -275,7 +275,7 @@

    Returns

    Examples

    Let’s first create a DataFrame containing small numeric values and then introduce that to GT(). We’ll then format the roman column to appear as Roman numerals with the fmt_roman() method.

    -
    +
    import pandas as pd
     from great_tables import GT
     
    @@ -286,52 +286,52 @@ 

    Examples

    .fmt_roman(columns="roman") )
    -
    +
    diff --git a/reference/GT.fmt_scientific.html b/reference/GT.fmt_scientific.html index c3c306556..b7e622e3d 100644 --- a/reference/GT.fmt_scientific.html +++ b/reference/GT.fmt_scientific.html @@ -348,7 +348,7 @@

    Adapt

    Examples

    For this example, we’ll use the exibble dataset as the input table. With the fmt_scientific() method, we’ll format the num column to contain values in scientific formatting.

    -
    +
    from great_tables import GT, exibble
     
     (
    @@ -356,52 +356,52 @@ 

    Examples

    .fmt_scientific(columns="num") )
    -
    +

    diff --git a/reference/GT.fmt_time.html b/reference/GT.fmt_time.html index 5977da7c4..165d38daa 100644 --- a/reference/GT.fmt_time.html +++ b/reference/GT.fmt_time.html @@ -334,7 +334,7 @@

    Adapt

    Examples

    Let’s use the exibble dataset to create a simple, two-column table (keeping only the date and time columns). With the fmt_time() method, we’ll format the time column to display times formatted with the "h_m_s_p" time style.

    -
    +
    from great_tables import GT, exibble
     
     exibble_mini = exibble[["date", "time"]]
    @@ -344,52 +344,52 @@ 

    Examples

    .fmt_time(columns="time", time_style="h_m_s_p") )
    -
    +

    diff --git a/reference/GT.fmt_units.html b/reference/GT.fmt_units.html index f172b283a..289e67268 100644 --- a/reference/GT.fmt_units.html +++ b/reference/GT.fmt_units.html @@ -287,7 +287,7 @@

    Returns

    Examples

    Let’s use the illness dataset and create a new table. The units column happens to contain string values in units notation (e.g., "x10^9 / L"). Using the fmt_units() method here will improve the formatting of those measurement units.

    -
    +
    from great_tables import GT, style, loc
     from great_tables.data import illness
     
    @@ -313,52 +313,52 @@ 

    Examples

    .opt_vertical_padding(scale=0.5) )
    -
    +
    @@ -907,7 +907,7 @@

    Examples

    The constants dataset contains values for hundreds of fundamental physical constants. We’ll take a subset of values that have some molar basis and generate a new display table from that. Like the illness dataset, this one has a units column so, again, the fmt_units() method will be used to format those units. Here, the preference for typesetting measurement units is to have positive and negative exponents (e.g., not "<unit_1> / <unit_2>" but rather "<unit_1> <unit_2>^-1").

    -
    +
    from great_tables.data import constants
     import polars as pl
     import polars.selectors as cs
    @@ -932,52 +932,52 @@ 

    Examples

    .tab_options(column_labels_hidden=True) )
    -
    +
    diff --git a/reference/GT.html b/reference/GT.html index d593f4dc2..5d2b86649 100644 --- a/reference/GT.html +++ b/reference/GT.html @@ -336,57 +336,57 @@

    Returns

    Examples

    Let’s use the exibble dataset for the next few examples, we’ll learn how to make simple output tables with the GT() class. The most basic thing to do is to just use GT() with the dataset as the input.

    -
    +
    from great_tables import GT, exibble
     
     GT(exibble)
    -
    +
    @@ -503,57 +503,57 @@

    Examples

    This dataset has the row and group columns. The former contains unique values that are ideal for labeling rows, and this often happens in what is called the ‘stub’ (a reserved area that serves to label rows). With the GT() class, we can immediately place the contents of the row column into the stub column. To do this, we use the rowname_col= argument with the appropriate column name.

    -
    +
    from great_tables import GT, exibble
     
     GT(exibble, rowname_col="row")
    -
    +
    @@ -671,57 +671,57 @@

    Examples

    This sets up a table with a stub, the row labels are placed within the stub column, and a vertical dividing line has been placed on the right-hand side.

    The group column contains categorical values that are ideal for grouping rows. We can use the groupname_col= argument to place these values into row groups.

    -
    +
    from great_tables import GT, exibble
     
     GT(exibble, rowname_col="row", groupname_col="group")
    -
    +
    @@ -835,57 +835,57 @@

    Examples

    By default, values in the body of a table (and their column labels) are automatically aligned. The alignment is governed by the types of values in a column. If you’d like to disable this form of auto-alignment, the auto_align=False option can be taken.

    -
    +
    from great_tables import GT, exibble
     
     GT(exibble, rowname_col="row", auto_align=False)
    -
    +
    @@ -1003,7 +1003,7 @@

    Examples

    What you’ll get from that is center-alignment of all table body values and all column labels. Note that row labels in the the stub are still left-aligned; and auto_align= has no effect on alignment within the table stub.

    However which way you generate the initial table object, you can modify it with a huge variety of methods to further customize the presentation. Formatting body cells is commonly done with the family of formatting methods (e.g., fmt_number(), fmt_date(), etc.). The package supports formatting with internationalization (‘i18n’ features) and so locale-aware methods all come with a locale= argument. To avoid having to use that argument repeatedly, the GT() class has its own locale= argument. Setting a locale in that will make it available globally. Here’s an example of how that works in practice when setting locale = "fr" in GT() prior to using formatting methods:

    -
    +
    from great_tables import GT, exibble
     
     (
    @@ -1013,52 +1013,52 @@ 

    Examples

    .fmt_date(columns="date", date_style="day_month_year") )
    -
    +
    @@ -1418,12 +1418,12 @@

    Returns

    Examples:

    Let’s use the row column of exibble dataset to create a table. With the as_raw_html() method, we’re able to output the HTML content.

    -
    +
    from great_tables import GT, exibble
     
     GT(exibble[["row"]]).as_raw_html()
    -
    '<div id="zltdnpqmjy" style="padding-left:0px;padding-right:0px;padding-top:10px;padding-bottom:10px;overflow-x:auto;overflow-y:auto;width:auto;height:auto;">\n<style>\n#zltdnpqmjy table {\n          font-family: -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, Oxygen, Ubuntu, Cantarell, \'Helvetica Neue\', \'Fira Sans\', \'Droid Sans\', Arial, sans-serif;\n          -webkit-font-smoothing: antialiased;\n          -moz-osx-font-smoothing: grayscale;\n        }\n\n#zltdnpqmjy thead, tbody, tfoot, tr, td, th { border-style: none; }\n tr { background-color: transparent; }\n#zltdnpqmjy p { margin: 0; padding: 0; }\n #zltdnpqmjy .gt_table { display: table; border-collapse: collapse; line-height: normal; margin-left: auto; margin-right: auto; color: #333333; font-size: 16px; font-weight: normal; font-style: normal; background-color: #FFFFFF; width: auto; border-top-style: solid; border-top-width: 2px; border-top-color: #A8A8A8; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #A8A8A8; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; }\n #zltdnpqmjy .gt_caption { padding-top: 4px; padding-bottom: 4px; }\n #zltdnpqmjy .gt_title { color: #333333; font-size: 125%; font-weight: initial; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; border-bottom-color: #FFFFFF; border-bottom-width: 0; }\n #zltdnpqmjy .gt_subtitle { color: #333333; font-size: 85%; font-weight: initial; padding-top: 3px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; border-top-color: #FFFFFF; border-top-width: 0; }\n #zltdnpqmjy .gt_heading { background-color: #FFFFFF; text-align: center; border-bottom-color: #FFFFFF; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; }\n #zltdnpqmjy .gt_bottom_border { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }\n #zltdnpqmjy .gt_col_headings { border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; }\n #zltdnpqmjy .gt_col_heading { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: normal; text-transform: inherit; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: bottom; padding-top: 5px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; overflow-x: hidden; }\n #zltdnpqmjy .gt_column_spanner_outer { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: normal; text-transform: inherit; padding-top: 0; padding-bottom: 0; padding-left: 4px; padding-right: 4px; }\n #zltdnpqmjy .gt_column_spanner_outer:first-child { padding-left: 0; }\n #zltdnpqmjy .gt_column_spanner_outer:last-child { padding-right: 0; }\n #zltdnpqmjy .gt_column_spanner { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; vertical-align: bottom; padding-top: 5px; padding-bottom: 5px; overflow-x: hidden; display: inline-block; width: 100%; }\n #zltdnpqmjy .gt_spanner_row { border-bottom-style: hidden; }\n #zltdnpqmjy .gt_group_heading { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: middle; text-align: left; }\n #zltdnpqmjy .gt_empty_group_heading { padding: 0.5px; color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; vertical-align: middle; }\n #zltdnpqmjy .gt_from_md> :first-child { margin-top: 0; }\n #zltdnpqmjy .gt_from_md> :last-child { margin-bottom: 0; }\n #zltdnpqmjy .gt_row { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; margin: 10px; border-top-style: solid; border-top-width: 1px; border-top-color: #D3D3D3; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: middle; overflow-x: hidden; }\n #zltdnpqmjy .gt_stub { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-right-style: solid; border-right-width: 2px; border-right-color: #D3D3D3; padding-left: 5px; padding-right: 5px; }\n #zltdnpqmjy .gt_stub_row_group { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-right-style: solid; border-right-width: 2px; border-right-color: #D3D3D3; padding-left: 5px; padding-right: 5px; vertical-align: top; }\n #zltdnpqmjy .gt_row_group_first td { border-top-width: 2px; }\n #zltdnpqmjy .gt_row_group_first th { border-top-width: 2px; }\n #zltdnpqmjy .gt_striped { background-color: rgba(128,128,128,0.05); }\n #zltdnpqmjy .gt_table_body { border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }\n #zltdnpqmjy .gt_sourcenotes { color: #333333; background-color: #FFFFFF; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; }\n #zltdnpqmjy .gt_sourcenote { font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; text-align: left; }\n #zltdnpqmjy .gt_left { text-align: left; }\n #zltdnpqmjy .gt_center { text-align: center; }\n #zltdnpqmjy .gt_right { text-align: right; font-variant-numeric: tabular-nums; }\n #zltdnpqmjy .gt_font_normal { font-weight: normal; }\n #zltdnpqmjy .gt_font_bold { font-weight: bold; }\n #zltdnpqmjy .gt_font_italic { font-style: italic; }\n #zltdnpqmjy .gt_super { font-size: 65%; }\n #zltdnpqmjy .gt_footnote_marks { font-size: 75%; vertical-align: 0.4em; position: initial; }\n #zltdnpqmjy .gt_asterisk { font-size: 100%; vertical-align: 0; }\n \n</style>\n<table class="gt_table" data-quarto-disable-processing="false" data-quarto-bootstrap="false">\n<thead>\n\n<tr class="gt_col_headings">\n  <th class="gt_col_heading gt_columns_bottom_border gt_left" rowspan="1" colspan="1" scope="col" id="row">row</th>\n</tr>\n</thead>\n<tbody class="gt_table_body">\n  <tr>\n    <td class="gt_row gt_left">row_1</td>\n  </tr>\n  <tr>\n    <td class="gt_row gt_left">row_2</td>\n  </tr>\n  <tr>\n    <td class="gt_row gt_left">row_3</td>\n  </tr>\n  <tr>\n    <td class="gt_row gt_left">row_4</td>\n  </tr>\n  <tr>\n    <td class="gt_row gt_left">row_5</td>\n  </tr>\n  <tr>\n    <td class="gt_row gt_left">row_6</td>\n  </tr>\n  <tr>\n    <td class="gt_row gt_left">row_7</td>\n  </tr>\n  <tr>\n    <td class="gt_row gt_left">row_8</td>\n  </tr>\n</tbody>\n\n\n</table>\n\n</div>\n        '
    +
    '<div id="aoeigwejsu" style="padding-left:0px;padding-right:0px;padding-top:10px;padding-bottom:10px;overflow-x:auto;overflow-y:auto;width:auto;height:auto;">\n<style>\n#aoeigwejsu table {\n          font-family: -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, Oxygen, Ubuntu, Cantarell, \'Helvetica Neue\', \'Fira Sans\', \'Droid Sans\', Arial, sans-serif;\n          -webkit-font-smoothing: antialiased;\n          -moz-osx-font-smoothing: grayscale;\n        }\n\n#aoeigwejsu thead, tbody, tfoot, tr, td, th { border-style: none; }\n tr { background-color: transparent; }\n#aoeigwejsu p { margin: 0; padding: 0; }\n #aoeigwejsu .gt_table { display: table; border-collapse: collapse; line-height: normal; margin-left: auto; margin-right: auto; color: #333333; font-size: 16px; font-weight: normal; font-style: normal; background-color: #FFFFFF; width: auto; border-top-style: solid; border-top-width: 2px; border-top-color: #A8A8A8; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #A8A8A8; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; }\n #aoeigwejsu .gt_caption { padding-top: 4px; padding-bottom: 4px; }\n #aoeigwejsu .gt_title { color: #333333; font-size: 125%; font-weight: initial; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; border-bottom-color: #FFFFFF; border-bottom-width: 0; }\n #aoeigwejsu .gt_subtitle { color: #333333; font-size: 85%; font-weight: initial; padding-top: 3px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; border-top-color: #FFFFFF; border-top-width: 0; }\n #aoeigwejsu .gt_heading { background-color: #FFFFFF; text-align: center; border-bottom-color: #FFFFFF; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; }\n #aoeigwejsu .gt_bottom_border { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }\n #aoeigwejsu .gt_col_headings { border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; }\n #aoeigwejsu .gt_col_heading { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: normal; text-transform: inherit; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: bottom; padding-top: 5px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; overflow-x: hidden; }\n #aoeigwejsu .gt_column_spanner_outer { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: normal; text-transform: inherit; padding-top: 0; padding-bottom: 0; padding-left: 4px; padding-right: 4px; }\n #aoeigwejsu .gt_column_spanner_outer:first-child { padding-left: 0; }\n #aoeigwejsu .gt_column_spanner_outer:last-child { padding-right: 0; }\n #aoeigwejsu .gt_column_spanner { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; vertical-align: bottom; padding-top: 5px; padding-bottom: 5px; overflow-x: hidden; display: inline-block; width: 100%; }\n #aoeigwejsu .gt_spanner_row { border-bottom-style: hidden; }\n #aoeigwejsu .gt_group_heading { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: middle; text-align: left; }\n #aoeigwejsu .gt_empty_group_heading { padding: 0.5px; color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; vertical-align: middle; }\n #aoeigwejsu .gt_from_md> :first-child { margin-top: 0; }\n #aoeigwejsu .gt_from_md> :last-child { margin-bottom: 0; }\n #aoeigwejsu .gt_row { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; margin: 10px; border-top-style: solid; border-top-width: 1px; border-top-color: #D3D3D3; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: middle; overflow-x: hidden; }\n #aoeigwejsu .gt_stub { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-right-style: solid; border-right-width: 2px; border-right-color: #D3D3D3; padding-left: 5px; padding-right: 5px; }\n #aoeigwejsu .gt_stub_row_group { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-right-style: solid; border-right-width: 2px; border-right-color: #D3D3D3; padding-left: 5px; padding-right: 5px; vertical-align: top; }\n #aoeigwejsu .gt_row_group_first td { border-top-width: 2px; }\n #aoeigwejsu .gt_row_group_first th { border-top-width: 2px; }\n #aoeigwejsu .gt_striped { background-color: rgba(128,128,128,0.05); }\n #aoeigwejsu .gt_table_body { border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }\n #aoeigwejsu .gt_sourcenotes { color: #333333; background-color: #FFFFFF; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; }\n #aoeigwejsu .gt_sourcenote { font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; text-align: left; }\n #aoeigwejsu .gt_left { text-align: left; }\n #aoeigwejsu .gt_center { text-align: center; }\n #aoeigwejsu .gt_right { text-align: right; font-variant-numeric: tabular-nums; }\n #aoeigwejsu .gt_font_normal { font-weight: normal; }\n #aoeigwejsu .gt_font_bold { font-weight: bold; }\n #aoeigwejsu .gt_font_italic { font-style: italic; }\n #aoeigwejsu .gt_super { font-size: 65%; }\n #aoeigwejsu .gt_footnote_marks { font-size: 75%; vertical-align: 0.4em; position: initial; }\n #aoeigwejsu .gt_asterisk { font-size: 100%; vertical-align: 0; }\n \n</style>\n<table class="gt_table" data-quarto-disable-processing="false" data-quarto-bootstrap="false">\n<thead>\n\n<tr class="gt_col_headings">\n  <th class="gt_col_heading gt_columns_bottom_border gt_left" rowspan="1" colspan="1" scope="col" id="row">row</th>\n</tr>\n</thead>\n<tbody class="gt_table_body">\n  <tr>\n    <td class="gt_row gt_left">row_1</td>\n  </tr>\n  <tr>\n    <td class="gt_row gt_left">row_2</td>\n  </tr>\n  <tr>\n    <td class="gt_row gt_left">row_3</td>\n  </tr>\n  <tr>\n    <td class="gt_row gt_left">row_4</td>\n  </tr>\n  <tr>\n    <td class="gt_row gt_left">row_5</td>\n  </tr>\n  <tr>\n    <td class="gt_row gt_left">row_6</td>\n  </tr>\n  <tr>\n    <td class="gt_row gt_left">row_7</td>\n  </tr>\n  <tr>\n    <td class="gt_row gt_left">row_8</td>\n  </tr>\n</tbody>\n\n\n</table>\n\n</div>\n        '
    @@ -1486,7 +1486,7 @@

    Returns

    Examples

    Let’s use the countrypops to create a small table. We can change the alignment of the population column with cols_align(). In this example, the column label and body cells of population will be aligned to the left.

    -
    +
    from great_tables import GT
     from great_tables.data import countrypops
     
    @@ -1499,52 +1499,52 @@ 

    Examples

    .cols_align(align="left", columns="population") )
    -
    +
    @@ -1642,7 +1642,7 @@

    Returns

    Examples

    For this example, we’ll use a portion of the countrypops dataset to create a simple table. Let’s hide the year column with the cols_hide() method.

    -
    +
    from great_tables import GT
     from great_tables.data import countrypops
     
    @@ -1652,52 +1652,52 @@ 

    Examples

    GT(countrypops_mini).cols_hide(columns="year")
    -
    +
    @@ -1806,7 +1806,7 @@

    Notes

    Examples

    The example below relabels columns from the countrypops data to start with uppercase.

    -
    +
    from great_tables import GT
     from great_tables.data import countrypops
     
    @@ -1823,52 +1823,52 @@ 

    Examples

    ) )
    -
    +
    @@ -1917,7 +1917,7 @@

    Examples

    Note that we supplied the name of the column as the key, and the new label as the value.

    We can also use Markdown formatting for the column labels. In this example, we’ll use md("*Population*") to make the label italicized.

    -
    +
    from great_tables import GT, md
     from great_tables.data import countrypops
     
    @@ -1930,52 +1930,52 @@ 

    Examples

    ) )
    -
    +
    @@ -2023,7 +2023,7 @@

    Examples

    We can also use unit notation to format the column labels. In this example, we’ll use {cm^3 molecules^-1 s^-1} for part of the label for the OH_k298 column.

    -
    +
    from great_tables import GT
     from great_tables.data import reactions
     import polars as pl
    @@ -2044,52 +2044,52 @@ 

    Examples

    ) )
    -
    +
    @@ -2215,7 +2215,7 @@

    Returns

    Examples

    Let’s use the countrypops dataset to create a table. We’ll choose to position the population column after the country_name column by using the cols_move() method.

    -
    +
    from great_tables import GT
     from great_tables.data import countrypops
     
    @@ -2231,52 +2231,52 @@ 

    Examples

    ) )
    -
    +
    @@ -2377,7 +2377,7 @@

    Returns

    Examples

    For this example, we’ll use a portion of the countrypops dataset to create a simple table. Let’s move the year column, which is the middle column, to the end of the column series with the cols_move_to_end() method.

    -
    +
    from great_tables import GT
     from great_tables.data import countrypops
     
    @@ -2387,52 +2387,52 @@ 

    Examples

    GT(countrypops_mini).cols_move_to_end(columns="year")
    -
    +
    @@ -2480,55 +2480,55 @@

    Examples

    We can also move multiple columns at a time. With the same countrypops-based table (countrypops_mini), let’s move both the year and country_name columns to the end of the column series.

    -
    +
    GT(countrypops_mini).cols_move_to_end(columns=["year", "country_name"])
    -
    +
    @@ -2630,7 +2630,7 @@

    Returns

    Examples

    For this example, we’ll use a portion of the countrypops dataset to create a simple table. Let’s move the year column, which is the middle column, to the start of the column series with the cols_move_to_start() method.

    -
    +
    from great_tables import GT
     from great_tables.data import countrypops
     
    @@ -2640,52 +2640,52 @@ 

    Examples

    GT(countrypops_mini).cols_move_to_start(columns="year")
    -
    +
    @@ -2733,55 +2733,55 @@

    Examples

    We can also move multiple columns at a time. With the same countrypops-based table (countrypops_mini), let’s move both the year and population columns to the start of the column series.

    -
    +
    GT(countrypops_mini).cols_move_to_start(columns=["year", "population"])
    -
    +
    @@ -2888,7 +2888,7 @@

    Returns

    Examples

    Let’s use select columns from the exibble dataset to create a new table. We can specify the widths of columns with cols_width(). This is done by specifying the exact widths for table columns in a dictionary. In this example, we’ll set the width of the num column to "150px", the char column to "100px", the date column to "300px". All other columns won’t be affected (their widths will be automatically set by their content).

    -
    +
    from great_tables import GT, exibble
     
     exibble_mini = exibble[["num", "char", "date", "datetime", "row"]].head(5)
    @@ -2904,52 +2904,52 @@ 

    Examples

    ) )
    -
    +
    @@ -3017,7 +3017,7 @@

    Examples

    We can also specify the widths of columns as percentages. In this example, we’ll set the width of the num column to "20%", the char column to "10%", and the date column to "30%". Note that the percentages are relative and don’t need to sum to 100%.

    -
    +
    (
         GT(exibble_mini)
         .cols_width(
    @@ -3029,52 +3029,52 @@ 

    Examples

    ) )
    -
    +
    @@ -3142,7 +3142,7 @@

    Examples

    We can also mix and match pixel and percentage widths. In this example, we’ll set the width of the num column to "150px", the char column to "10%", and the date column to "30%".

    -
    +
    (
         GT(exibble_mini)
         .cols_width(
    @@ -3154,52 +3154,52 @@ 

    Examples

    ) )
    -
    +
    @@ -3267,7 +3267,7 @@

    Examples

    If we set the width of all columns, the table will be forced to use the specified widths (i.e., a column width less than the content width will be honored). In this next example, we’ll set widths for all columns. This is a good way to ensure that the widths you specify are fully respected (and not overridden by automatic width calculations).

    -
    +
    (
         GT(exibble_mini)
         .cols_width(
    @@ -3281,52 +3281,52 @@ 

    Examples

    ) )
    -
    +
    @@ -3759,58 +3759,58 @@

    Examples

    The data_color() method can be used without any supplied arguments to colorize a table. Let’s do this with the exibble dataset:

    -
    +
    from great_tables import GT
     from great_tables.data import exibble
     
     GT(exibble).data_color()
    -
    +
    @@ -3928,58 +3928,58 @@

    Examples

    What’s happened is that data_color() applies background colors to all cells of every column with the palette of eight colors. Numeric columns will use ‘numeric’ methodology for color scaling whereas string-based columns will use the ‘factor’ methodology. The text color undergoes an automatic modification that maximizes contrast (since autocolor_text=True by default).

    We can target specific colors and apply color to just those columns. Let’s do that and also supply palette= values of "red" and "green".

    -
    +
    GT(exibble).data_color(
         columns=["num", "currency"],
         palette=["red", "green"]
     )
    -
    +
    @@ -4097,7 +4097,7 @@

    Examples

    With those options in place we see that only the numeric columns num and currency received color treatments. Moreover, the palette colors were mapped to the lower and upper limits of the data in each column; interpolated colors were used for the values in between the numeric limits of the two columns.

    We can manually set the limits of the data with the domain= argument (which is preferable in most cases). Let’s colorize just the currency column and set domain=[0, 50]. Any values that are either missing or lie outside of the domain will be colorized with the na_color= color (so we’ll set that to "lightgray").

    -
    +
    GT(exibble).data_color(
         columns="currency",
         palette=["red", "green"],
    @@ -4105,52 +4105,52 @@ 

    Examples

    na_color="lightgray" )
    -
    +
    @@ -4339,7 +4339,7 @@

    Returns

    Examples

    Let’s use the exibble dataset to create a table. With the fmt() method, we’ll add a prefix ^ and a suffix $ to the row and group columns.

    -
    +
    from great_tables import GT, exibble
     
     (
    @@ -4347,52 +4347,52 @@ 

    Examples

    .fmt(lambda x: f"^{x}$", columns=["row", "group"]) )
    -
    +
    @@ -4645,7 +4645,7 @@

    Adapt

    Examples

    Let’s use a single column from the exibble dataset and create a new table. We’ll format the num column to display as byte sizes in the decimal standard through use of the fmt_bytes() method.

    -
    +
    from great_tables import GT, exibble
     
     (
    @@ -4653,52 +4653,52 @@ 

    Examples

    .fmt_bytes(columns="num", standard="decimal") )
    -
    +

    @@ -4898,7 +4898,7 @@

    Ada

    Examples

    Let’s use the exibble dataset to create a table. With the fmt_currency() method, we’ll format the currency column to display monetary values.

    -
    +
    from great_tables import GT, exibble
     
     (
    @@ -4910,52 +4910,52 @@ 

    Examples

    ) )
    -
    +

    @@ -5258,7 +5258,7 @@

    Ada

    Examples

    Let’s use the exibble dataset to create a simple, two-column table (keeping only the date and time columns). With the fmt_date() method, we’ll format the date column to display dates formatted with the "month_day_year" date style.

    -
    +
    from great_tables import GT, exibble
     
     exibble_mini = exibble[["date", "time"]]
    @@ -5268,52 +5268,52 @@ 

    Examples

    .fmt_date(columns="date", date_style="month_day_year") )
    -
    +

    @@ -5586,7 +5586,7 @@

    Returns

    Examples

    Let’s use the exibble dataset to create a simple, two-column table (keeping only the date and time columns). With the fmt_datetime() method, we’ll format the date column to display dates formatted with the "month_day_year" date style and the time column to display times formatted with the "h_m_s_p" time style.

    -
    +
    from great_tables import GT, exibble
     
     exibble_mini = exibble[["date", "time"]]
    @@ -5600,52 +5600,52 @@ 

    Examples

    ) )
    -
    +
    @@ -5794,7 +5794,7 @@

    Returns

    Examples

    Using a small portion of metro dataset, let’s create a new table. We will only include a few columns and rows from that table. The lines column has comma-separated listings of numbers corresponding to lines served at each station. We have a directory of SVG graphics for all of these lines in the package (the path for the image directory can be accessed via files("great_tables") / "data/metro_images", using the importlib_resources package). The filenames roughly corresponds to the data in the lines column. The fmt_image() method can be used with these inputs since the path= and file_pattern= arguments allow us to compose complete and valid file locations. What you get from this are sequences of images in the table cells, taken from the referenced graphics files on disk.

    -
    +
    from great_tables import GT
     from great_tables.data import metro
     from importlib_resources import files
    @@ -5813,52 +5813,52 @@ 

    Examples

    .fmt_integer(columns="passengers") )
    -
    +
    @@ -6020,7 +6020,7 @@

    Ada

    Examples

    For this example, we’ll use the exibble dataset as the input table. With the fmt_integer() method, we’ll format the num column as integer values having no digit separators (with the use_seps=False option).

    -
    +
    from great_tables import GT, exibble
     
     (
    @@ -6028,52 +6028,52 @@ 

    Examples

    .fmt_integer(columns="num", use_seps=False) )
    -
    +

    @@ -6253,7 +6253,7 @@

    Returns

    Examples:

    Let’s first create a DataFrame containing some text that is Markdown-formatted and then introduce that to GT(). We’ll then transform the md column with the fmt_markdown() method.

    -
    +
    import pandas as pd
     from great_tables import GT
     from great_tables.data import towny
    @@ -6277,52 +6277,52 @@ 

    Examples:

    (GT(df).fmt_markdown("md"))
    -
    +
    @@ -6484,7 +6484,7 @@

    Details

    Examples

    Let’s create a nanoplot from a Polars DataFrame containing multiple numbers per cell. The numbers are represented here as strings, where spaces separate the values, and the same values are present in two columns: lines and bars. We will use the fmt_nanoplot() method twice to create a line plot and a bar plot from the data in their respective columns.

    -
    +
    from great_tables import GT
     import polars as pl
     
    @@ -6506,52 +6506,52 @@ 

    Examples

    .fmt_nanoplot(columns="bars", plot_type="bar") )
    -
    +
    @@ -6594,7 +6594,7 @@

    Examples

    We can always represent the input DataFrame in a different way (with list columns) and fmt_nanoplot() will still work. While the input data is the same as in the previous example, we’ll take the opportunity here to add a reference line and a reference area to the line plot and also to the bar plot.

    -
    +
    random_numbers_df = pl.DataFrame(
         {
             "i": range(1, 5),
    @@ -6621,52 +6621,52 @@ 

    Examples

    reference_area=["max", "median"]) )
    -
    +
    @@ -6709,7 +6709,7 @@

    Examples

    Here’s an example to adjust some of the options using nanoplot_options().

    -
    +
    from great_tables import nanoplot_options
     
     (
    @@ -6749,52 +6749,52 @@ 

    Examples

    ) )
    -
    +
    @@ -6837,7 +6837,7 @@

    Examples

    Single-value bar plots and line plots can be made with fmt_nanoplot(). These run in the horizontal direction, which is ideal for tabular presentation. The key thing here is that fmt_nanoplot() expects a column of numeric values. These plots are meant for comparison across rows so the method automatically scales the horizontal bars to facilitate this type of display. The following example shows how fmt_nanoplot() can be used to create single-value bar and line plots.

    -
    +
    single_vals_df = pl.DataFrame(
         {
             "i": range(1, 6),
    @@ -6851,52 +6851,52 @@ 

    Examples

    .fmt_nanoplot(columns="lines", plot_type="line") )
    -
    +
    @@ -7082,7 +7082,7 @@

    Ada

    Examples

    Let’s use the exibble dataset to create a table. With the fmt_number() method, we’ll format the num column to have three decimal places (with decimals=3) and omit the use of digit separators (with use_seps=False).

    -
    +
    from great_tables import GT, exibble
     
     (
    @@ -7090,52 +7090,52 @@ 

    Examples

    .fmt_number(columns="num", decimals=3, use_seps=False) )
    -
    +

    @@ -7400,7 +7400,7 @@

    Ada

    Examples

    Let’s use the towny dataset as the input table. With the fmt_percent() method, we’ll format the pop_change_2016_2021_pct column to to display values as percentages (to two decimal places).

    -
    +
    from great_tables import GT
     from great_tables.data import towny
     
    @@ -7411,52 +7411,52 @@ 

    Examples

    (GT(towny_mini).fmt_percent("pop_change_2016_2021_pct", decimals=2))
    -
    +

    @@ -7593,7 +7593,7 @@

    Returns

    Examples

    Let’s first create a DataFrame containing small numeric values and then introduce that to GT(). We’ll then format the roman column to appear as Roman numerals with the fmt_roman() method.

    -
    +
    import pandas as pd
     from great_tables import GT
     
    @@ -7604,52 +7604,52 @@ 

    Examples

    .fmt_roman(columns="roman") )
    -
    +
    @@ -7834,7 +7834,7 @@

    Ada

    Examples

    For this example, we’ll use the exibble dataset as the input table. With the fmt_scientific() method, we’ll format the num column to contain values in scientific formatting.

    -
    +
    from great_tables import GT, exibble
     
     (
    @@ -7842,52 +7842,52 @@ 

    Examples

    .fmt_scientific(columns="num") )
    -
    +

    @@ -8136,7 +8136,7 @@

    Ada

    Examples

    Let’s use the exibble dataset to create a simple, two-column table (keeping only the date and time columns). With the fmt_time() method, we’ll format the time column to display times formatted with the "h_m_s_p" time style.

    -
    +
    from great_tables import GT, exibble
     
     exibble_mini = exibble[["date", "time"]]
    @@ -8146,52 +8146,52 @@ 

    Examples

    .fmt_time(columns="time", time_style="h_m_s_p") )
    -
    +

    @@ -8331,7 +8331,7 @@

    Returns

    Examples

    Let’s use the illness dataset and create a new table. The units column happens to contain string values in units notation (e.g., "x10^9 / L"). Using the fmt_units() method here will improve the formatting of those measurement units.

    -
    +
    from great_tables import GT, style, loc
     from great_tables.data import illness
     
    @@ -8357,52 +8357,52 @@ 

    Examples

    .opt_vertical_padding(scale=0.5) )
    -
    +
    @@ -8951,7 +8951,7 @@

    Examples

    The constants dataset contains values for hundreds of fundamental physical constants. We’ll take a subset of values that have some molar basis and generate a new display table from that. Like the illness dataset, this one has a units column so, again, the fmt_units() method will be used to format those units. Here, the preference for typesetting measurement units is to have positive and negative exponents (e.g., not "<unit_1> / <unit_2>" but rather "<unit_1> <unit_2>^-1").

    -
    +
    from great_tables.data import constants
     import polars as pl
     import polars.selectors as cs
    @@ -8976,52 +8976,52 @@ 

    Examples

    .tab_options(column_labels_hidden=True) )
    -
    +
    @@ -9180,7 +9180,7 @@

    Returns

    Examples

    Using select columns from the exibble dataset, let’s create a table with a number of components added. Following that, we’ll align the header contents (consisting of the title and the subtitle) to the left with the opt_align_table_header() method.

    -
    +
    from great_tables import GT, exibble, md
     
     (
    @@ -9199,52 +9199,52 @@ 

    Examples

    .opt_align_table_header(align="left") )
    -
    +
    @@ -9393,7 +9393,7 @@

    Returns

    Examples

    Using select columns from the exibble dataset, let’s create a table with a number of components added. Following that, we’ll ensure that all text in the column labels, the stub, and in all row groups is transformed to all caps using the opt_all_caps() method.

    -
    +
    from great_tables import GT, exibble, md
     
     (
    @@ -9412,52 +9412,52 @@ 

    Examples

    .opt_all_caps() )
    -
    +
    @@ -9657,7 +9657,7 @@

    Returns

    Examples

    Using select columns from the exibble dataset, let’s create a table with a number of components added. Following that, we’ll scale the horizontal padding of the table by a factor of 3 using the opt_horizontal_padding() method.

    -
    +
    from great_tables import GT, exibble, md
     
     gt_tbl = (
    @@ -9677,52 +9677,52 @@ 

    Examples

    gt_tbl.opt_horizontal_padding(scale=3)
    -
    +
    @@ -9813,55 +9813,55 @@

    Examples

    The overall effect of scaling the horizontal padding is that the table will appear wider or and there will added buffer space between the table elements. The overall look of the table will be more spacious and neigboring pieces of text will be less cramped.

    Let’s go the other way and scale the horizontal padding of the table by a factor of 0.5 using the opt_horizontal_padding() method.

    -
    +
    gt_tbl.opt_horizontal_padding(scale=0.5)
    -
    +
    @@ -10005,7 +10005,7 @@

    Returns

    Examples

    Using only a few columns from the exibble dataset, let’s create a table with a number of components added. Following that, we’ll add row striping to every second row with the opt_row_striping() method.

    -
    +
    from great_tables import GT, exibble, md
     
     (
    @@ -10024,52 +10024,52 @@ 

    Examples

    .opt_row_striping() )
    -
    +
    @@ -10224,7 +10224,7 @@

    Returns

    Examples

    Using select columns from the exibble dataset, let’s create a table with a number of components added. Following that, we’ll apply a predefined style to the table using the opt_stylize() method.

    -
    +
    from great_tables import GT, exibble, md
     
     gt_tbl = (
    @@ -10245,52 +10245,52 @@ 

    Examples

    gt_tbl
    -
    +
    @@ -10381,55 +10381,55 @@

    Examples

    The table has been stylized with the default style and color. The default style is 1 and the default color is "blue". The resulting table style is a combination of color and border settings that are applied to the table.

    We can modify the overall style and choose a different color theme by providing different values to the style= and color= arguments.

    -
    +
    gt_tbl.opt_stylize(style=2, color="green")
    -
    +
    @@ -10617,7 +10617,7 @@

    Possi

    Examples

    Let’s use a subset of the sp500 dataset to create a small table. With opt_table_font() we can add some preferred font choices for modifying the text of the entire table. Here we’ll use the "Superclarendon" and "Georgia" fonts (the second font serves as a fallback).

    -
    +
    import polars as pl
     from great_tables import GT
     from great_tables.data import sp500
    @@ -10630,52 +10630,52 @@ 

    Examples

    .opt_table_font(font=["Superclarendon", "Georgia"]) )
    -
    +

    @@ -10771,7 +10771,7 @@

    Examples

    In practice, both of these fonts are not likely to be available on all systems. The opt_table_font() method safeguards against this by prepending the fonts in the font= list to the existing font stack. This way, if both fonts are not available, the table will fall back to using the list of default table fonts. This behavior is controlled by the add= argument, which is True by default.

    With the sza dataset we’ll create a two-column, eleven-row table. Within opt_table_font(), the stack= argument will be supplied with the “rounded-sans” font stack. This sets up a family of fonts with rounded, curved letterforms that should be locally available in different computing environments.

    -
    +
    from great_tables.data import sza
     
     sza_mini = (
    @@ -10787,52 +10787,52 @@ 

    Examples

    .opt_all_caps() )
    -
    +
    @@ -10963,7 +10963,7 @@

    Returns

    Examples

    Using select columns from the exibble dataset, let’s create a table with a number of components added. Following that, we’ll put an outline around the entire table using the opt_table_outline() method.

    -
    +
    from great_tables import GT, exibble, md
     
     (
    @@ -10982,52 +10982,52 @@ 

    Examples

    .opt_table_outline() )
    -
    +
    @@ -11170,7 +11170,7 @@

    Returns

    Examples

    Using select columns from the exibble dataset, let’s create a table with a number of components added. Following that, we’ll scale the vertical padding of the table by a factor of 3 using the opt_vertical_padding() method.

    -
    +
    from great_tables import GT, exibble, md
     
     gt_tbl = (
    @@ -11190,52 +11190,52 @@ 

    Examples

    gt_tbl.opt_vertical_padding(scale=3)
    -
    +
    @@ -11326,55 +11326,55 @@

    Examples

    Now that’s a tall table! The overall effect of scaling the vertical padding is that the table will appear taller and there will be more buffer space between the table elements. A value of 3 is pretty extreme and is likely to be too much in most cases, so, feel free to experiment with different values when looking to increase the vertical padding.

    Let’s go the other way (using a value less than 1) and try to condense the content vertically with a scale factor of 0.5. This will reduce the top and bottom padding globally and make the table appear more compact.

    -
    +
    gt_tbl.opt_vertical_padding(scale=0.5)
    -
    +
    @@ -11615,58 +11615,58 @@

    Parameters

    Examples

    The example below when in the Great Tables documentation, should appear on the page.

    -
    +
    from great_tables import GT, exibble
     
     GT(exibble.head(2)).show()
     GT(exibble.tail(2)).show()
    -
    +
    @@ -11716,52 +11716,52 @@

    Examples

    -
    +
    @@ -11871,7 +11871,7 @@

    Returns

    Examples

    Using a subset of the exibble dataset, let’s create a new table. The missing values in two selections of columns will be given different variations of replacement text (across two separate calls of sub_missing()).

    -
    +
    from great_tables import GT, md, html, exibble
     import polars as pl
     import polars.selectors as cs
    @@ -11890,52 +11890,52 @@ 

    Examples

    ) )
    -
    +
    @@ -12052,7 +12052,7 @@

    Returns

    Examples

    Let’s generate a simple table that contains an assortment of values that could potentially undergo some substitution via the sub_zero() method (i.e., there are two 0 values). The ordering of the fmt_scientific() and sub_zero() calls in the example below doesn’t affect the final result since any sub_*() method won’t interfere with the formatting of the table.

    -
    +
    from great_tables import GT
     import polars as pl
     
    @@ -12065,52 +12065,52 @@ 

    Examples

    GT(single_vals_df).fmt_scientific(columns="numbers").sub_zero()
    -
    +
    @@ -12219,7 +12219,7 @@

    Returns

    Examples

    Let’s use a small portion of the gtcars dataset to create a table. A header part can be added to the table with the tab_header() method. We’ll add a title and the optional subtitle as well. With the md() helper function, we can make sure the Markdown formatting is interpreted and transformed.

    -
    +
    from great_tables import GT, md
     from great_tables.data import gtcars
     
    @@ -12233,52 +12233,52 @@ 

    Examples

    ) )
    -
    +
    @@ -12332,7 +12332,7 @@

    Examples

    We can alternatively use the html() helper function to retain HTML elements in the text.

    -
    +
    from great_tables import GT, md, html
     from great_tables.data import gtcars
     
    @@ -12346,52 +12346,52 @@ 

    Examples

    ) )
    -
    +
    @@ -13212,7 +13212,7 @@

    Returns

    Examples

    Using select columns from the exibble dataset, let’s create a new table with a number of table components added. We can use this object going forward to demonstrate some of the features available in the tab_options() method.

    -
    +
    from great_tables import GT, exibble, md
     
     gt_tbl = (
    @@ -13232,52 +13232,52 @@ 

    Examples

    gt_tbl
    -
    +
    @@ -13367,55 +13367,55 @@

    Examples

    We can modify the table width to be set as "100%“. In effect, this spans the table to entirely fill the content width area. This is done with the table_width option.

    -
    +
    gt_tbl.tab_options(table_width="100%")
    -
    +
    @@ -13505,55 +13505,55 @@

    Examples

    With the table_background_color option, we can modify the table’s background color. Here, we want that to be "lightcyan".

    -
    +
    gt_tbl.tab_options(table_background_color="lightcyan")
    -
    +
    @@ -13643,55 +13643,55 @@

    Examples

    The data rows of a table typically take up the most physical space but we have some control over the extent of that. With the data_row_padding option, it’s possible to modify the top and bottom padding of data rows. We’ll do just that in the following example, reducing the padding to a value of "3px".

    -
    +
    gt_tbl.tab_options(data_row_padding="3px")
    -
    +
    @@ -13781,55 +13781,55 @@

    Examples

    The size of the title and the subtitle text in the header of the table can be altered with the heading_title_font_size and heading_subtitle_font_size options. Here, we’ll use the "small" and "x-small" keyword values.

    -
    +
    gt_tbl.tab_options(heading_title_font_size="small", heading_subtitle_font_size="x-small")
    -
    +
    @@ -13966,7 +13966,7 @@

    Returns

    Examples

    With three columns from the gtcars dataset, let’s create a new table. We can use the tab_source_note() method to add a source note to the table footer. Here we are citing the data source but this method can be used for any text you’d prefer to display in the footer component of the table.

    -
    +
    from great_tables import GT
     from great_tables.data import gtcars
     
    @@ -13977,52 +13977,52 @@ 

    Examples

    .tab_source_note(source_note="From edmunds.com") )
    -
    +
    @@ -14160,7 +14160,7 @@

    Returns

    Examples

    Let’s create a table using a small portion of the gtcars dataset. Over several columns (hp, hp_rpm, trq, trq_rpm, mpg_c, mpg_h) we’ll use tab_spanner() to add a spanner with the label "performance". This effectively groups together several columns related to car performance under a unifying label.

    -
    +
    from great_tables import GT
     from great_tables.data import gtcars
     
    @@ -14175,52 +14175,52 @@ 

    Examples

    ) )
    -
    +
    @@ -14342,7 +14342,7 @@

    Examples

    We can also use Markdown formatting for the spanner label. In this example, we’ll use gt.md("*Performance*") to make the label italicized.

    -
    +
    from great_tables import GT, md
     from great_tables.data import gtcars
     
    @@ -14357,52 +14357,52 @@ 

    Examples

    ) )
    -
    +
    @@ -14565,57 +14565,57 @@

    Parameters

    Examples

    By default, all data is together in the body of the table.

    -
    +
    from great_tables import GT, exibble
     
     GT(exibble)
    -
    +
    @@ -14732,55 +14732,55 @@

    Examples

    The table stub separates row names with a vertical line, and puts group names on their own line.

    -
    +
    GT(exibble).tab_stub(rowname_col="row", groupname_col="group")
    -
    +
    @@ -14941,7 +14941,7 @@

    Returns

    Examples

    Using a small subset of the gtcars dataset, we can create a table with row labels. Since we have row labels in the stub (via use of rowname_col="model" in the GT() call) we have a stubhead, so, let’s add a stubhead label ("car") with the tab_stubhead() method to describe what’s in the stub.

    -
    +
    from great_tables import GT
     from great_tables.data import gtcars
     
    @@ -14952,52 +14952,52 @@ 

    Examples

    .tab_stubhead(label="car") )
    -
    +
    @@ -15051,7 +15051,7 @@

    Examples

    We can also use Markdown formatting for the stubhead label. In this example, we’ll use md("*Car*") to make the label italicized.

    -
    +
    from great_tables import GT, md
     from great_tables.data import gtcars
     
    @@ -15060,52 +15060,52 @@ 

    Examples

    .tab_stubhead(label=md("*Car*")) )
    -
    +
    @@ -15226,7 +15226,7 @@

    Returns

    Examples

    Let’s use a small subset of the exibble dataset to demonstrate how to use tab_style() to target specific cells and apply styles to them. We’ll start by creating the exibble_sm table (a subset of the exibble table) and then use tab_style() to apply a light cyan background color to the cells in the num column for the first two rows of the table. We’ll then apply a larger font size to the cells in the fctr column for the last four rows of the table.

    -
    +
    from great_tables import GT, style, loc, exibble
     
     exibble_sm = exibble[["num", "fctr", "row", "group"]]
    @@ -15243,52 +15243,52 @@ 

    Examples

    ) )
    -
    +
    @@ -15357,7 +15357,7 @@

    Examples

    Let’s use exibble once again to create a simple, two-column output table (keeping only the num and currency columns). With the tab_style() method (called thrice), we’ll add style to the values already formatted by fmt_number() and fmt_currency(). In the style argument of the first two tab_style() call, we can define multiple types of styling with the style.fill() and style.text() classes (enclosing these in a list). The cells to be targeted for styling require the use of loc.body(), which is used here with different columns being targeted. For the final tab_style() call, we demonstrate the use of style.borders() class as the style argument, which is employed in conjunction with loc.body() to locate the row to be styled.

    -
    +
    from great_tables import GT, style, loc, exibble
     
     (
    @@ -15384,52 +15384,52 @@ 

    Examples

    ) )
    -
    +
    diff --git a/reference/GT.opt_align_table_header.html b/reference/GT.opt_align_table_header.html index 9b91a432e..7570504c3 100644 --- a/reference/GT.opt_align_table_header.html +++ b/reference/GT.opt_align_table_header.html @@ -256,7 +256,7 @@

    Returns

    Examples

    Using select columns from the exibble dataset, let’s create a table with a number of components added. Following that, we’ll align the header contents (consisting of the title and the subtitle) to the left with the opt_align_table_header() method.

    -
    +
    from great_tables import GT, exibble, md
     
     (
    @@ -275,52 +275,52 @@ 

    Examples

    .opt_align_table_header(align="left") )
    -
    +
    diff --git a/reference/GT.opt_all_caps.html b/reference/GT.opt_all_caps.html index 1d44556eb..0225d37e9 100644 --- a/reference/GT.opt_all_caps.html +++ b/reference/GT.opt_all_caps.html @@ -262,7 +262,7 @@

    Returns

    Examples

    Using select columns from the exibble dataset, let’s create a table with a number of components added. Following that, we’ll ensure that all text in the column labels, the stub, and in all row groups is transformed to all caps using the opt_all_caps() method.

    -
    +
    from great_tables import GT, exibble, md
     
     (
    @@ -281,52 +281,52 @@ 

    Examples

    .opt_all_caps() )
    -
    +
    diff --git a/reference/GT.opt_horizontal_padding.html b/reference/GT.opt_horizontal_padding.html index bc36d7548..72ee1eee8 100644 --- a/reference/GT.opt_horizontal_padding.html +++ b/reference/GT.opt_horizontal_padding.html @@ -256,7 +256,7 @@

    Returns

    Examples

    Using select columns from the exibble dataset, let’s create a table with a number of components added. Following that, we’ll scale the horizontal padding of the table by a factor of 3 using the opt_horizontal_padding() method.

    -
    +
    from great_tables import GT, exibble, md
     
     gt_tbl = (
    @@ -276,52 +276,52 @@ 

    Examples

    gt_tbl.opt_horizontal_padding(scale=3)
    -
    +
    @@ -412,55 +412,55 @@

    Examples

    The overall effect of scaling the horizontal padding is that the table will appear wider or and there will added buffer space between the table elements. The overall look of the table will be more spacious and neigboring pieces of text will be less cramped.

    Let’s go the other way and scale the horizontal padding of the table by a factor of 0.5 using the opt_horizontal_padding() method.

    -
    +
    gt_tbl.opt_horizontal_padding(scale=0.5)
    -
    +
    diff --git a/reference/GT.opt_row_striping.html b/reference/GT.opt_row_striping.html index 614af4e5a..c909f5705 100644 --- a/reference/GT.opt_row_striping.html +++ b/reference/GT.opt_row_striping.html @@ -256,7 +256,7 @@

    Returns

    Examples

    Using only a few columns from the exibble dataset, let’s create a table with a number of components added. Following that, we’ll add row striping to every second row with the opt_row_striping() method.

    -
    +
    from great_tables import GT, exibble, md
     
     (
    @@ -275,52 +275,52 @@ 

    Examples

    .opt_row_striping() )
    -
    +
    diff --git a/reference/GT.opt_stylize.html b/reference/GT.opt_stylize.html index 06009a6b4..663fb8bda 100644 --- a/reference/GT.opt_stylize.html +++ b/reference/GT.opt_stylize.html @@ -268,7 +268,7 @@

    Returns

    Examples

    Using select columns from the exibble dataset, let’s create a table with a number of components added. Following that, we’ll apply a predefined style to the table using the opt_stylize() method.

    -
    +
    from great_tables import GT, exibble, md
     
     gt_tbl = (
    @@ -289,52 +289,52 @@ 

    Examples

    gt_tbl
    -
    +
    @@ -425,55 +425,55 @@

    Examples

    The table has been stylized with the default style and color. The default style is 1 and the default color is "blue". The resulting table style is a combination of color and border settings that are applied to the table.

    We can modify the overall style and choose a different color theme by providing different values to the style= and color= arguments.

    -
    +
    gt_tbl.opt_stylize(style=2, color="green")
    -
    +
    diff --git a/reference/GT.opt_table_font.html b/reference/GT.opt_table_font.html index c0b308e74..e54b73844 100644 --- a/reference/GT.opt_table_font.html +++ b/reference/GT.opt_table_font.html @@ -302,7 +302,7 @@

    Possi

    Examples

    Let’s use a subset of the sp500 dataset to create a small table. With opt_table_font() we can add some preferred font choices for modifying the text of the entire table. Here we’ll use the "Superclarendon" and "Georgia" fonts (the second font serves as a fallback).

    -
    +
    import polars as pl
     from great_tables import GT
     from great_tables.data import sp500
    @@ -315,52 +315,52 @@ 

    Examples

    .opt_table_font(font=["Superclarendon", "Georgia"]) )
    -
    +

    @@ -456,7 +456,7 @@

    Examples

    In practice, both of these fonts are not likely to be available on all systems. The opt_table_font() method safeguards against this by prepending the fonts in the font= list to the existing font stack. This way, if both fonts are not available, the table will fall back to using the list of default table fonts. This behavior is controlled by the add= argument, which is True by default.

    With the sza dataset we’ll create a two-column, eleven-row table. Within opt_table_font(), the stack= argument will be supplied with the “rounded-sans” font stack. This sets up a family of fonts with rounded, curved letterforms that should be locally available in different computing environments.

    -
    +
    from great_tables.data import sza
     
     sza_mini = (
    @@ -472,52 +472,52 @@ 

    Examples

    .opt_all_caps() )
    -
    +
    diff --git a/reference/GT.opt_table_outline.html b/reference/GT.opt_table_outline.html index c6e1a9ad3..62895df15 100644 --- a/reference/GT.opt_table_outline.html +++ b/reference/GT.opt_table_outline.html @@ -268,7 +268,7 @@

    Returns

    Examples

    Using select columns from the exibble dataset, let’s create a table with a number of components added. Following that, we’ll put an outline around the entire table using the opt_table_outline() method.

    -
    +
    from great_tables import GT, exibble, md
     
     (
    @@ -287,52 +287,52 @@ 

    Examples

    .opt_table_outline() )
    -
    +
    diff --git a/reference/GT.opt_vertical_padding.html b/reference/GT.opt_vertical_padding.html index 334af9994..5b0e3dd5b 100644 --- a/reference/GT.opt_vertical_padding.html +++ b/reference/GT.opt_vertical_padding.html @@ -256,7 +256,7 @@

    Returns

    Examples

    Using select columns from the exibble dataset, let’s create a table with a number of components added. Following that, we’ll scale the vertical padding of the table by a factor of 3 using the opt_vertical_padding() method.

    -
    +
    from great_tables import GT, exibble, md
     
     gt_tbl = (
    @@ -276,52 +276,52 @@ 

    Examples

    gt_tbl.opt_vertical_padding(scale=3)
    -
    +
    @@ -412,55 +412,55 @@

    Examples

    Now that’s a tall table! The overall effect of scaling the vertical padding is that the table will appear taller and there will be more buffer space between the table elements. A value of 3 is pretty extreme and is likely to be too much in most cases, so, feel free to experiment with different values when looking to increase the vertical padding.

    Let’s go the other way (using a value less than 1) and try to condense the content vertically with a scale factor of 0.5. This will reduce the top and bottom padding globally and make the table appear more compact.

    -
    +
    gt_tbl.opt_vertical_padding(scale=0.5)
    -
    +
    diff --git a/reference/GT.show.html b/reference/GT.show.html index 2e92273e7..f4d208e97 100644 --- a/reference/GT.show.html +++ b/reference/GT.show.html @@ -238,58 +238,58 @@

    Parameters

    Examples

    The example below when in the Great Tables documentation, should appear on the page.

    -
    +
    from great_tables import GT, exibble
     
     GT(exibble.head(2)).show()
     GT(exibble.tail(2)).show()
    -
    +
    @@ -339,52 +339,52 @@

    Examples

    -
    +
    diff --git a/reference/GT.sub_missing.html b/reference/GT.sub_missing.html index 8acb5893c..6ee9706c2 100644 --- a/reference/GT.sub_missing.html +++ b/reference/GT.sub_missing.html @@ -262,7 +262,7 @@

    Returns

    Examples

    Using a subset of the exibble dataset, let’s create a new table. The missing values in two selections of columns will be given different variations of replacement text (across two separate calls of sub_missing()).

    -
    +
    from great_tables import GT, md, html, exibble
     import polars as pl
     import polars.selectors as cs
    @@ -281,52 +281,52 @@ 

    Examples

    ) )
    -
    +
    diff --git a/reference/GT.sub_zero.html b/reference/GT.sub_zero.html index e6c19e335..5bf803113 100644 --- a/reference/GT.sub_zero.html +++ b/reference/GT.sub_zero.html @@ -262,7 +262,7 @@

    Returns

    Examples

    Let’s generate a simple table that contains an assortment of values that could potentially undergo some substitution via the sub_zero() method (i.e., there are two 0 values). The ordering of the fmt_scientific() and sub_zero() calls in the example below doesn’t affect the final result since any sub_*() method won’t interfere with the formatting of the table.

    -
    +
    from great_tables import GT
     import polars as pl
     
    @@ -275,52 +275,52 @@ 

    Examples

    GT(single_vals_df).fmt_scientific(columns="numbers").sub_zero()
    -
    +
    diff --git a/reference/GT.tab_header.html b/reference/GT.tab_header.html index dec6f1162..e7a73528a 100644 --- a/reference/GT.tab_header.html +++ b/reference/GT.tab_header.html @@ -262,7 +262,7 @@

    Returns

    Examples

    Let’s use a small portion of the gtcars dataset to create a table. A header part can be added to the table with the tab_header() method. We’ll add a title and the optional subtitle as well. With the md() helper function, we can make sure the Markdown formatting is interpreted and transformed.

    -
    +
    from great_tables import GT, md
     from great_tables.data import gtcars
     
    @@ -276,52 +276,52 @@ 

    Examples

    ) )
    -
    +
    @@ -375,7 +375,7 @@

    Examples

    We can alternatively use the html() helper function to retain HTML elements in the text.

    -
    +
    from great_tables import GT, md, html
     from great_tables.data import gtcars
     
    @@ -389,52 +389,52 @@ 

    Examples

    ) )
    -
    +
    diff --git a/reference/GT.tab_options.html b/reference/GT.tab_options.html index 1d9b6b480..0499185df 100644 --- a/reference/GT.tab_options.html +++ b/reference/GT.tab_options.html @@ -970,7 +970,7 @@

    Returns

    Examples

    Using select columns from the exibble dataset, let’s create a new table with a number of table components added. We can use this object going forward to demonstrate some of the features available in the tab_options() method.

    -
    +
    from great_tables import GT, exibble, md
     
     gt_tbl = (
    @@ -990,52 +990,52 @@ 

    Examples

    gt_tbl
    -
    +
    @@ -1125,55 +1125,55 @@

    Examples

    We can modify the table width to be set as "100%“. In effect, this spans the table to entirely fill the content width area. This is done with the table_width option.

    -
    +
    gt_tbl.tab_options(table_width="100%")
    -
    +
    @@ -1263,55 +1263,55 @@

    Examples

    With the table_background_color option, we can modify the table’s background color. Here, we want that to be "lightcyan".

    -
    +
    gt_tbl.tab_options(table_background_color="lightcyan")
    -
    +
    @@ -1401,55 +1401,55 @@

    Examples

    The data rows of a table typically take up the most physical space but we have some control over the extent of that. With the data_row_padding option, it’s possible to modify the top and bottom padding of data rows. We’ll do just that in the following example, reducing the padding to a value of "3px".

    -
    +
    gt_tbl.tab_options(data_row_padding="3px")
    -
    +
    @@ -1539,55 +1539,55 @@

    Examples

    The size of the title and the subtitle text in the header of the table can be altered with the heading_title_font_size and heading_subtitle_font_size options. Here, we’ll use the "small" and "x-small" keyword values.

    -
    +
    gt_tbl.tab_options(heading_title_font_size="small", heading_subtitle_font_size="x-small")
    -
    +
    diff --git a/reference/GT.tab_source_note.html b/reference/GT.tab_source_note.html index d1cfcba48..7577fd8ec 100644 --- a/reference/GT.tab_source_note.html +++ b/reference/GT.tab_source_note.html @@ -250,7 +250,7 @@

    Returns

    Examples

    With three columns from the gtcars dataset, let’s create a new table. We can use the tab_source_note() method to add a source note to the table footer. Here we are citing the data source but this method can be used for any text you’d prefer to display in the footer component of the table.

    -
    +
    from great_tables import GT
     from great_tables.data import gtcars
     
    @@ -261,52 +261,52 @@ 

    Examples

    .tab_source_note(source_note="From edmunds.com") )
    -
    +
    diff --git a/reference/GT.tab_spanner.html b/reference/GT.tab_spanner.html index 499488de2..4c270ea9e 100644 --- a/reference/GT.tab_spanner.html +++ b/reference/GT.tab_spanner.html @@ -287,7 +287,7 @@

    Returns

    Examples

    Let’s create a table using a small portion of the gtcars dataset. Over several columns (hp, hp_rpm, trq, trq_rpm, mpg_c, mpg_h) we’ll use tab_spanner() to add a spanner with the label "performance". This effectively groups together several columns related to car performance under a unifying label.

    -
    +
    from great_tables import GT
     from great_tables.data import gtcars
     
    @@ -302,52 +302,52 @@ 

    Examples

    ) )
    -
    +
    @@ -469,7 +469,7 @@

    Examples

    We can also use Markdown formatting for the spanner label. In this example, we’ll use gt.md("*Performance*") to make the label italicized.

    -
    +
    from great_tables import GT, md
     from great_tables.data import gtcars
     
    @@ -484,52 +484,52 @@ 

    Examples

    ) )
    -
    +
    diff --git a/reference/GT.tab_stub.html b/reference/GT.tab_stub.html index 8b2dc39fe..08b476b2b 100644 --- a/reference/GT.tab_stub.html +++ b/reference/GT.tab_stub.html @@ -243,57 +243,57 @@

    Parameters

    Examples

    By default, all data is together in the body of the table.

    -
    +
    from great_tables import GT, exibble
     
     GT(exibble)
    -
    +
    @@ -410,55 +410,55 @@

    Examples

    The table stub separates row names with a vertical line, and puts group names on their own line.

    -
    +
    GT(exibble).tab_stub(rowname_col="row", groupname_col="group")
    -
    +
    diff --git a/reference/GT.tab_stubhead.html b/reference/GT.tab_stubhead.html index c782da899..69853ba54 100644 --- a/reference/GT.tab_stubhead.html +++ b/reference/GT.tab_stubhead.html @@ -250,7 +250,7 @@

    Returns

    Examples

    Using a small subset of the gtcars dataset, we can create a table with row labels. Since we have row labels in the stub (via use of rowname_col="model" in the GT() call) we have a stubhead, so, let’s add a stubhead label ("car") with the tab_stubhead() method to describe what’s in the stub.

    -
    +
    from great_tables import GT
     from great_tables.data import gtcars
     
    @@ -261,52 +261,52 @@ 

    Examples

    .tab_stubhead(label="car") )
    -
    +
    @@ -360,7 +360,7 @@

    Examples

    We can also use Markdown formatting for the stubhead label. In this example, we’ll use md("*Car*") to make the label italicized.

    -
    +
    from great_tables import GT, md
     from great_tables.data import gtcars
     
    @@ -369,52 +369,52 @@ 

    Examples

    .tab_stubhead(label=md("*Car*")) )
    -
    +
    diff --git a/reference/GT.tab_style.html b/reference/GT.tab_style.html index 0ddd9ff8b..e1ffa9fd0 100644 --- a/reference/GT.tab_style.html +++ b/reference/GT.tab_style.html @@ -270,7 +270,7 @@

    Returns

    Examples

    Let’s use a small subset of the exibble dataset to demonstrate how to use tab_style() to target specific cells and apply styles to them. We’ll start by creating the exibble_sm table (a subset of the exibble table) and then use tab_style() to apply a light cyan background color to the cells in the num column for the first two rows of the table. We’ll then apply a larger font size to the cells in the fctr column for the last four rows of the table.

    -
    +
    from great_tables import GT, style, loc, exibble
     
     exibble_sm = exibble[["num", "fctr", "row", "group"]]
    @@ -287,52 +287,52 @@ 

    Examples

    ) )
    -
    +
    @@ -401,7 +401,7 @@

    Examples

    Let’s use exibble once again to create a simple, two-column output table (keeping only the num and currency columns). With the tab_style() method (called thrice), we’ll add style to the values already formatted by fmt_number() and fmt_currency(). In the style argument of the first two tab_style() call, we can define multiple types of styling with the style.fill() and style.text() classes (enclosing these in a list). The cells to be targeted for styling require the use of loc.body(), which is used here with different columns being targeted. For the final tab_style() call, we demonstrate the use of style.borders() class as the style argument, which is employed in conjunction with loc.body() to locate the row to be styled.

    -
    +
    from great_tables import GT, style, loc, exibble
     
     (
    @@ -428,52 +428,52 @@ 

    Examples

    ) )
    -
    +
    diff --git a/reference/define_units.html b/reference/define_units.html index 3ea69dfa3..e792bd24e 100644 --- a/reference/define_units.html +++ b/reference/define_units.html @@ -225,54 +225,54 @@

    Returns

    Specification Of Units Notation

    The following table demonstrates the various ways in which units can be specified in the units_notation string and how the input is processed by the define_units() function. The concluding step for display of the units in HTML is to use the to_html() method.

    -
    +
    -
    +
    diff --git a/reference/from_column.html b/reference/from_column.html index 061c01cc1..1492f18ba 100644 --- a/reference/from_column.html +++ b/reference/from_column.html @@ -208,7 +208,7 @@

    from_column

    Specify that a style value should be fetched from a column in the data.

    Examples

    -
    +
    import pandas as pd
     from great_tables import GT, exibble, from_column, loc, style
     
    @@ -222,52 +222,52 @@ 

    Examples

    ) )
    -
    +
    @@ -297,7 +297,7 @@

    Examples

    If you are using polars, you can just pass polars expressions in directly:

    -
    +
    import polars as pl
     from great_tables import GT, exibble, from_column, loc, style
     
    @@ -311,52 +311,52 @@ 

    Examples

    ) )
    -
    +
    diff --git a/reference/google_font.html b/reference/google_font.html index 6e1741ca9..468421ec5 100644 --- a/reference/google_font.html +++ b/reference/google_font.html @@ -264,7 +264,7 @@

    Returns

    Examples

    Let’s use the exibble dataset to create a table of two columns and eight rows. We’ll replace missing values with em dashes using sub_missing(). For text in the time column, we will use the font called "IBM Plex Mono" which is available from Google Fonts. This is defined inside the google_font() call, itself within the style.text() method that’s applied to the style= parameter of tab_style().

    -
    +
    from great_tables import GT, exibble, style, loc, google_font
     
     (
    @@ -276,53 +276,53 @@ 

    Examples

    ) )
    -
    +
    @@ -376,7 +376,7 @@

    Examples

    We can use a subset of the sp500 dataset to create a small table. With fmt_currency(), we can display values as monetary values. Then, we’ll set a larger font size for the table and opt to use the "Merriweather" font by calling google_font() within opt_table_font(). In cases where that font may not materialize, we include two font fallbacks: "Cochin" and the catchall "Serif" group.

    -
    +
    from great_tables import GT, google_font
     from great_tables.data import sp500
     
    @@ -387,53 +387,53 @@ 

    Examples

    .opt_table_font(font=[google_font(name="Merriweather"), "Cochin", "Serif"]) )
    -
    +
    diff --git a/reference/system_fonts.html b/reference/system_fonts.html index 00d942af6..2f1203c1d 100644 --- a/reference/system_fonts.html +++ b/reference/system_fonts.html @@ -356,7 +356,7 @@

    Handwritten (

    Examples

    Using select columns from the exibble dataset, let’s create a table with a number of components added. Following that, we’ll set a font for the entire table using the tab_options() method with the table_font_names parameter. Instead of passing a list of font names, we’ll use the system_fonts() helper function to get a font stack. In this case, we’ll use the "industrial" font stack.

    -
    +
    from great_tables import GT, exibble, md, system_fonts
     
     (
    @@ -376,52 +376,52 @@ 

    Examples

    .tab_options(table_font_names=system_fonts("industrial")) )
    -
    +

    diff --git a/search.json b/search.json index 6ae289bd3..142f223d9 100644 --- a/search.json +++ b/search.json @@ -856,7 +856,7 @@ "href": "reference/GT.as_raw_html.html#examples", "title": "GT.as_raw_html", "section": "Examples:", - "text": "Examples:\nLet’s use the row column of exibble dataset to create a table. With the as_raw_html() method, we’re able to output the HTML content.\n\nfrom great_tables import GT, exibble\n\nGT(exibble[[\"row\"]]).as_raw_html()\n\n'<div id=\"rlonmggyup\" style=\"padding-left:0px;padding-right:0px;padding-top:10px;padding-bottom:10px;overflow-x:auto;overflow-y:auto;width:auto;height:auto;\">\\n<style>\\n#rlonmggyup table {\\n font-family: -apple-system, BlinkMacSystemFont, \\'Segoe UI\\', Roboto, Oxygen, Ubuntu, Cantarell, \\'Helvetica Neue\\', \\'Fira Sans\\', \\'Droid Sans\\', Arial, sans-serif;\\n -webkit-font-smoothing: antialiased;\\n -moz-osx-font-smoothing: grayscale;\\n }\\n\\n#rlonmggyup thead, tbody, tfoot, tr, td, th { border-style: none; }\\n tr { background-color: transparent; }\\n#rlonmggyup p { margin: 0; padding: 0; }\\n #rlonmggyup .gt_table { display: table; border-collapse: collapse; line-height: normal; margin-left: auto; margin-right: auto; color: #333333; font-size: 16px; font-weight: normal; font-style: normal; background-color: #FFFFFF; width: auto; border-top-style: solid; border-top-width: 2px; border-top-color: #A8A8A8; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #A8A8A8; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; }\\n #rlonmggyup .gt_caption { padding-top: 4px; padding-bottom: 4px; }\\n #rlonmggyup .gt_title { color: #333333; font-size: 125%; font-weight: initial; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; border-bottom-color: #FFFFFF; border-bottom-width: 0; }\\n #rlonmggyup .gt_subtitle { color: #333333; font-size: 85%; font-weight: initial; padding-top: 3px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; border-top-color: #FFFFFF; border-top-width: 0; }\\n #rlonmggyup .gt_heading { background-color: #FFFFFF; text-align: center; border-bottom-color: #FFFFFF; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; }\\n #rlonmggyup .gt_bottom_border { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }\\n #rlonmggyup .gt_col_headings { border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; }\\n #rlonmggyup .gt_col_heading { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: normal; text-transform: inherit; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: bottom; padding-top: 5px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; overflow-x: hidden; }\\n #rlonmggyup .gt_column_spanner_outer { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: normal; text-transform: inherit; padding-top: 0; padding-bottom: 0; padding-left: 4px; padding-right: 4px; }\\n #rlonmggyup .gt_column_spanner_outer:first-child { padding-left: 0; }\\n #rlonmggyup .gt_column_spanner_outer:last-child { padding-right: 0; }\\n #rlonmggyup .gt_column_spanner { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; vertical-align: bottom; padding-top: 5px; padding-bottom: 5px; overflow-x: hidden; display: inline-block; width: 100%; }\\n #rlonmggyup .gt_spanner_row { border-bottom-style: hidden; }\\n #rlonmggyup .gt_group_heading { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: middle; text-align: left; }\\n #rlonmggyup .gt_empty_group_heading { padding: 0.5px; color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; vertical-align: middle; }\\n #rlonmggyup .gt_from_md> :first-child { margin-top: 0; }\\n #rlonmggyup .gt_from_md> :last-child { margin-bottom: 0; }\\n #rlonmggyup .gt_row { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; margin: 10px; border-top-style: solid; border-top-width: 1px; border-top-color: #D3D3D3; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: middle; overflow-x: hidden; }\\n #rlonmggyup .gt_stub { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-right-style: solid; border-right-width: 2px; border-right-color: #D3D3D3; padding-left: 5px; padding-right: 5px; }\\n #rlonmggyup .gt_stub_row_group { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-right-style: solid; border-right-width: 2px; border-right-color: #D3D3D3; padding-left: 5px; padding-right: 5px; vertical-align: top; }\\n #rlonmggyup .gt_row_group_first td { border-top-width: 2px; }\\n #rlonmggyup .gt_row_group_first th { border-top-width: 2px; }\\n #rlonmggyup .gt_striped { background-color: rgba(128,128,128,0.05); }\\n #rlonmggyup .gt_table_body { border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }\\n #rlonmggyup .gt_sourcenotes { color: #333333; background-color: #FFFFFF; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; }\\n #rlonmggyup .gt_sourcenote { font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; text-align: left; }\\n #rlonmggyup .gt_left { text-align: left; }\\n #rlonmggyup .gt_center { text-align: center; }\\n #rlonmggyup .gt_right { text-align: right; font-variant-numeric: tabular-nums; }\\n #rlonmggyup .gt_font_normal { font-weight: normal; }\\n #rlonmggyup .gt_font_bold { font-weight: bold; }\\n #rlonmggyup .gt_font_italic { font-style: italic; }\\n #rlonmggyup .gt_super { font-size: 65%; }\\n #rlonmggyup .gt_footnote_marks { font-size: 75%; vertical-align: 0.4em; position: initial; }\\n #rlonmggyup .gt_asterisk { font-size: 100%; vertical-align: 0; }\\n \\n</style>\\n<table class=\"gt_table\" data-quarto-disable-processing=\"false\" data-quarto-bootstrap=\"false\">\\n<thead>\\n\\n<tr class=\"gt_col_headings\">\\n <th class=\"gt_col_heading gt_columns_bottom_border gt_left\" rowspan=\"1\" colspan=\"1\" scope=\"col\" id=\"row\">row</th>\\n</tr>\\n</thead>\\n<tbody class=\"gt_table_body\">\\n <tr>\\n <td class=\"gt_row gt_left\">row_1</td>\\n </tr>\\n <tr>\\n <td class=\"gt_row gt_left\">row_2</td>\\n </tr>\\n <tr>\\n <td class=\"gt_row gt_left\">row_3</td>\\n </tr>\\n <tr>\\n <td class=\"gt_row gt_left\">row_4</td>\\n </tr>\\n <tr>\\n <td class=\"gt_row gt_left\">row_5</td>\\n </tr>\\n <tr>\\n <td class=\"gt_row gt_left\">row_6</td>\\n </tr>\\n <tr>\\n <td class=\"gt_row gt_left\">row_7</td>\\n </tr>\\n <tr>\\n <td class=\"gt_row gt_left\">row_8</td>\\n </tr>\\n</tbody>\\n\\n\\n</table>\\n\\n</div>\\n '" + "text": "Examples:\nLet’s use the row column of exibble dataset to create a table. With the as_raw_html() method, we’re able to output the HTML content.\n\nfrom great_tables import GT, exibble\n\nGT(exibble[[\"row\"]]).as_raw_html()\n\n'<div id=\"nafnqvtxlv\" style=\"padding-left:0px;padding-right:0px;padding-top:10px;padding-bottom:10px;overflow-x:auto;overflow-y:auto;width:auto;height:auto;\">\\n<style>\\n#nafnqvtxlv table {\\n font-family: -apple-system, BlinkMacSystemFont, \\'Segoe UI\\', Roboto, Oxygen, Ubuntu, Cantarell, \\'Helvetica Neue\\', \\'Fira Sans\\', \\'Droid Sans\\', Arial, sans-serif;\\n -webkit-font-smoothing: antialiased;\\n -moz-osx-font-smoothing: grayscale;\\n }\\n\\n#nafnqvtxlv thead, tbody, tfoot, tr, td, th { border-style: none; }\\n tr { background-color: transparent; }\\n#nafnqvtxlv p { margin: 0; padding: 0; }\\n #nafnqvtxlv .gt_table { display: table; border-collapse: collapse; line-height: normal; margin-left: auto; margin-right: auto; color: #333333; font-size: 16px; font-weight: normal; font-style: normal; background-color: #FFFFFF; width: auto; border-top-style: solid; border-top-width: 2px; border-top-color: #A8A8A8; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #A8A8A8; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; }\\n #nafnqvtxlv .gt_caption { padding-top: 4px; padding-bottom: 4px; }\\n #nafnqvtxlv .gt_title { color: #333333; font-size: 125%; font-weight: initial; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; border-bottom-color: #FFFFFF; border-bottom-width: 0; }\\n #nafnqvtxlv .gt_subtitle { color: #333333; font-size: 85%; font-weight: initial; padding-top: 3px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; border-top-color: #FFFFFF; border-top-width: 0; }\\n #nafnqvtxlv .gt_heading { background-color: #FFFFFF; text-align: center; border-bottom-color: #FFFFFF; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; }\\n #nafnqvtxlv .gt_bottom_border { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }\\n #nafnqvtxlv .gt_col_headings { border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; }\\n #nafnqvtxlv .gt_col_heading { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: normal; text-transform: inherit; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: bottom; padding-top: 5px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; overflow-x: hidden; }\\n #nafnqvtxlv .gt_column_spanner_outer { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: normal; text-transform: inherit; padding-top: 0; padding-bottom: 0; padding-left: 4px; padding-right: 4px; }\\n #nafnqvtxlv .gt_column_spanner_outer:first-child { padding-left: 0; }\\n #nafnqvtxlv .gt_column_spanner_outer:last-child { padding-right: 0; }\\n #nafnqvtxlv .gt_column_spanner { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; vertical-align: bottom; padding-top: 5px; padding-bottom: 5px; overflow-x: hidden; display: inline-block; width: 100%; }\\n #nafnqvtxlv .gt_spanner_row { border-bottom-style: hidden; }\\n #nafnqvtxlv .gt_group_heading { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: middle; text-align: left; }\\n #nafnqvtxlv .gt_empty_group_heading { padding: 0.5px; color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; vertical-align: middle; }\\n #nafnqvtxlv .gt_from_md> :first-child { margin-top: 0; }\\n #nafnqvtxlv .gt_from_md> :last-child { margin-bottom: 0; }\\n #nafnqvtxlv .gt_row { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; margin: 10px; border-top-style: solid; border-top-width: 1px; border-top-color: #D3D3D3; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: middle; overflow-x: hidden; }\\n #nafnqvtxlv .gt_stub { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-right-style: solid; border-right-width: 2px; border-right-color: #D3D3D3; padding-left: 5px; padding-right: 5px; }\\n #nafnqvtxlv .gt_stub_row_group { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-right-style: solid; border-right-width: 2px; border-right-color: #D3D3D3; padding-left: 5px; padding-right: 5px; vertical-align: top; }\\n #nafnqvtxlv .gt_row_group_first td { border-top-width: 2px; }\\n #nafnqvtxlv .gt_row_group_first th { border-top-width: 2px; }\\n #nafnqvtxlv .gt_striped { background-color: rgba(128,128,128,0.05); }\\n #nafnqvtxlv .gt_table_body { border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }\\n #nafnqvtxlv .gt_sourcenotes { color: #333333; background-color: #FFFFFF; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; }\\n #nafnqvtxlv .gt_sourcenote { font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; text-align: left; }\\n #nafnqvtxlv .gt_left { text-align: left; }\\n #nafnqvtxlv .gt_center { text-align: center; }\\n #nafnqvtxlv .gt_right { text-align: right; font-variant-numeric: tabular-nums; }\\n #nafnqvtxlv .gt_font_normal { font-weight: normal; }\\n #nafnqvtxlv .gt_font_bold { font-weight: bold; }\\n #nafnqvtxlv .gt_font_italic { font-style: italic; }\\n #nafnqvtxlv .gt_super { font-size: 65%; }\\n #nafnqvtxlv .gt_footnote_marks { font-size: 75%; vertical-align: 0.4em; position: initial; }\\n #nafnqvtxlv .gt_asterisk { font-size: 100%; vertical-align: 0; }\\n \\n</style>\\n<table class=\"gt_table\" data-quarto-disable-processing=\"false\" data-quarto-bootstrap=\"false\">\\n<thead>\\n\\n<tr class=\"gt_col_headings\">\\n <th class=\"gt_col_heading gt_columns_bottom_border gt_left\" rowspan=\"1\" colspan=\"1\" scope=\"col\" id=\"row\">row</th>\\n</tr>\\n</thead>\\n<tbody class=\"gt_table_body\">\\n <tr>\\n <td class=\"gt_row gt_left\">row_1</td>\\n </tr>\\n <tr>\\n <td class=\"gt_row gt_left\">row_2</td>\\n </tr>\\n <tr>\\n <td class=\"gt_row gt_left\">row_3</td>\\n </tr>\\n <tr>\\n <td class=\"gt_row gt_left\">row_4</td>\\n </tr>\\n <tr>\\n <td class=\"gt_row gt_left\">row_5</td>\\n </tr>\\n <tr>\\n <td class=\"gt_row gt_left\">row_6</td>\\n </tr>\\n <tr>\\n <td class=\"gt_row gt_left\">row_7</td>\\n </tr>\\n <tr>\\n <td class=\"gt_row gt_left\">row_8</td>\\n </tr>\\n</tbody>\\n\\n\\n</table>\\n\\n</div>\\n '" }, { "objectID": "reference/GT.html", @@ -891,7 +891,7 @@ "href": "reference/GT.html#methods", "title": "GT", "section": "Methods", - "text": "Methods\n\n\n\nName\nDescription\n\n\n\n\nas_raw_html\nGet the HTML content of a GT object.\n\n\ncols_align\nSet the alignment of one or more columns.\n\n\ncols_hide\nHide one or more columns.\n\n\ncols_label\nRelabel one or more columns.\n\n\ncols_move\nMove one or more columns.\n\n\ncols_move_to_end\nMove one or more columns to the end.\n\n\ncols_move_to_start\nMove one or more columns to the start.\n\n\ncols_width\nSet the widths of columns.\n\n\ndata_color\nPerform data cell colorization.\n\n\nfmt\nSet a column format with a formatter function.\n\n\nfmt_bytes\nFormat values as bytes.\n\n\nfmt_currency\nFormat values as currencies.\n\n\nfmt_date\nFormat values as dates.\n\n\nfmt_datetime\nFormat values as datetimes.\n\n\nfmt_image\nFormat image paths to generate images in cells.\n\n\nfmt_integer\nFormat values as integers.\n\n\nfmt_markdown\nFormat Markdown text.\n\n\nfmt_nanoplot\nFormat data for nanoplot visualizations.\n\n\nfmt_number\nFormat numeric values.\n\n\nfmt_percent\nFormat values as a percentage.\n\n\nfmt_roman\nFormat values as Roman numerals.\n\n\nfmt_scientific\nFormat values to scientific notation.\n\n\nfmt_time\nFormat values as times.\n\n\nfmt_units\nFormat measurement units.\n\n\nopt_align_table_header\nOption to align the table header.\n\n\nopt_all_caps\nOption to use all caps in select table locations.\n\n\nopt_footnote_marks\nOption to modify the set of footnote marks\n\n\nopt_horizontal_padding\nOption to scale the horizontal padding of the table.\n\n\nopt_row_striping\nOption to add or remove row striping.\n\n\nopt_stylize\nStylize your table with a colorful look.\n\n\nopt_table_font\nOptions to define font choices for the entire table.\n\n\nopt_table_outline\nOption to wrap an outline around the entire table.\n\n\nopt_vertical_padding\nOption to scale the vertical padding of the table.\n\n\nsave\nProduce a high-resolution image file or PDF of the table.\n\n\nshow\nDisplay the table in a notebook or a web browser.\n\n\nsub_missing\nSubstitute missing values in the table body.\n\n\nsub_zero\nSubstitute zero values in the table body.\n\n\ntab_header\nAdd a table header.\n\n\ntab_options\nModify the table output options.\n\n\ntab_source_note\nAdd a source note citation.\n\n\ntab_spanner\nInsert a spanner above a selection of column headings.\n\n\ntab_stub\nAdd a table stub, to emphasize row and group information.\n\n\ntab_stubhead\nAdd label text to the stubhead.\n\n\ntab_style\nAdd custom style to one or more cells\n\n\nwith_id\nSet the id for this table.\n\n\nwith_locale\nSet a column to be the default locale.\n\n\n\n\nas_raw_html\nGT.as_raw_html(self, make_page=False, all_important=False)\nGet the HTML content of a GT object.\nGet the HTML content from a GT object as a string. This function is useful for obtaining the HTML content of a GT object for use in other contexts.\n\nParameters\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\ngt\n\nA GT object.\nrequired\n\n\n\n\n\nReturns\n\n\n\nType\nDescription\n\n\n\n\nstr\nAn HTML fragment containing a table.\n\n\n\n\n\nExamples:\nLet’s use the row column of exibble dataset to create a table. With the as_raw_html() method, we’re able to output the HTML content.\n\nfrom great_tables import GT, exibble\n\nGT(exibble[[\"row\"]]).as_raw_html()\n\n'<div id=\"zltdnpqmjy\" style=\"padding-left:0px;padding-right:0px;padding-top:10px;padding-bottom:10px;overflow-x:auto;overflow-y:auto;width:auto;height:auto;\">\\n<style>\\n#zltdnpqmjy table {\\n font-family: -apple-system, BlinkMacSystemFont, \\'Segoe UI\\', Roboto, Oxygen, Ubuntu, Cantarell, \\'Helvetica Neue\\', \\'Fira Sans\\', \\'Droid Sans\\', Arial, sans-serif;\\n -webkit-font-smoothing: antialiased;\\n -moz-osx-font-smoothing: grayscale;\\n }\\n\\n#zltdnpqmjy thead, tbody, tfoot, tr, td, th { border-style: none; }\\n tr { background-color: transparent; }\\n#zltdnpqmjy p { margin: 0; padding: 0; }\\n #zltdnpqmjy .gt_table { display: table; border-collapse: collapse; line-height: normal; margin-left: auto; margin-right: auto; color: #333333; font-size: 16px; font-weight: normal; font-style: normal; background-color: #FFFFFF; width: auto; border-top-style: solid; border-top-width: 2px; border-top-color: #A8A8A8; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #A8A8A8; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; }\\n #zltdnpqmjy .gt_caption { padding-top: 4px; padding-bottom: 4px; }\\n #zltdnpqmjy .gt_title { color: #333333; font-size: 125%; font-weight: initial; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; border-bottom-color: #FFFFFF; border-bottom-width: 0; }\\n #zltdnpqmjy .gt_subtitle { color: #333333; font-size: 85%; font-weight: initial; padding-top: 3px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; border-top-color: #FFFFFF; border-top-width: 0; }\\n #zltdnpqmjy .gt_heading { background-color: #FFFFFF; text-align: center; border-bottom-color: #FFFFFF; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; }\\n #zltdnpqmjy .gt_bottom_border { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }\\n #zltdnpqmjy .gt_col_headings { border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; }\\n #zltdnpqmjy .gt_col_heading { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: normal; text-transform: inherit; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: bottom; padding-top: 5px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; overflow-x: hidden; }\\n #zltdnpqmjy .gt_column_spanner_outer { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: normal; text-transform: inherit; padding-top: 0; padding-bottom: 0; padding-left: 4px; padding-right: 4px; }\\n #zltdnpqmjy .gt_column_spanner_outer:first-child { padding-left: 0; }\\n #zltdnpqmjy .gt_column_spanner_outer:last-child { padding-right: 0; }\\n #zltdnpqmjy .gt_column_spanner { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; vertical-align: bottom; padding-top: 5px; padding-bottom: 5px; overflow-x: hidden; display: inline-block; width: 100%; }\\n #zltdnpqmjy .gt_spanner_row { border-bottom-style: hidden; }\\n #zltdnpqmjy .gt_group_heading { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: middle; text-align: left; }\\n #zltdnpqmjy .gt_empty_group_heading { padding: 0.5px; color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; vertical-align: middle; }\\n #zltdnpqmjy .gt_from_md> :first-child { margin-top: 0; }\\n #zltdnpqmjy .gt_from_md> :last-child { margin-bottom: 0; }\\n #zltdnpqmjy .gt_row { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; margin: 10px; border-top-style: solid; border-top-width: 1px; border-top-color: #D3D3D3; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: middle; overflow-x: hidden; }\\n #zltdnpqmjy .gt_stub { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-right-style: solid; border-right-width: 2px; border-right-color: #D3D3D3; padding-left: 5px; padding-right: 5px; }\\n #zltdnpqmjy .gt_stub_row_group { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-right-style: solid; border-right-width: 2px; border-right-color: #D3D3D3; padding-left: 5px; padding-right: 5px; vertical-align: top; }\\n #zltdnpqmjy .gt_row_group_first td { border-top-width: 2px; }\\n #zltdnpqmjy .gt_row_group_first th { border-top-width: 2px; }\\n #zltdnpqmjy .gt_striped { background-color: rgba(128,128,128,0.05); }\\n #zltdnpqmjy .gt_table_body { border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }\\n #zltdnpqmjy .gt_sourcenotes { color: #333333; background-color: #FFFFFF; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; }\\n #zltdnpqmjy .gt_sourcenote { font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; text-align: left; }\\n #zltdnpqmjy .gt_left { text-align: left; }\\n #zltdnpqmjy .gt_center { text-align: center; }\\n #zltdnpqmjy .gt_right { text-align: right; font-variant-numeric: tabular-nums; }\\n #zltdnpqmjy .gt_font_normal { font-weight: normal; }\\n #zltdnpqmjy .gt_font_bold { font-weight: bold; }\\n #zltdnpqmjy .gt_font_italic { font-style: italic; }\\n #zltdnpqmjy .gt_super { font-size: 65%; }\\n #zltdnpqmjy .gt_footnote_marks { font-size: 75%; vertical-align: 0.4em; position: initial; }\\n #zltdnpqmjy .gt_asterisk { font-size: 100%; vertical-align: 0; }\\n \\n</style>\\n<table class=\"gt_table\" data-quarto-disable-processing=\"false\" data-quarto-bootstrap=\"false\">\\n<thead>\\n\\n<tr class=\"gt_col_headings\">\\n <th class=\"gt_col_heading gt_columns_bottom_border gt_left\" rowspan=\"1\" colspan=\"1\" scope=\"col\" id=\"row\">row</th>\\n</tr>\\n</thead>\\n<tbody class=\"gt_table_body\">\\n <tr>\\n <td class=\"gt_row gt_left\">row_1</td>\\n </tr>\\n <tr>\\n <td class=\"gt_row gt_left\">row_2</td>\\n </tr>\\n <tr>\\n <td class=\"gt_row gt_left\">row_3</td>\\n </tr>\\n <tr>\\n <td class=\"gt_row gt_left\">row_4</td>\\n </tr>\\n <tr>\\n <td class=\"gt_row gt_left\">row_5</td>\\n </tr>\\n <tr>\\n <td class=\"gt_row gt_left\">row_6</td>\\n </tr>\\n <tr>\\n <td class=\"gt_row gt_left\">row_7</td>\\n </tr>\\n <tr>\\n <td class=\"gt_row gt_left\">row_8</td>\\n </tr>\\n</tbody>\\n\\n\\n</table>\\n\\n</div>\\n '\n\n\n\n\n\ncols_align\nGT.cols_align(self, align='left', columns=None)\nSet the alignment of one or more columns.\nThe cols_align() method sets the alignment of one or more columns. The align argument can be set to one of \"left\", \"center\", or \"right\" and the columns argument can be used to specify which columns to apply the alignment to. If columns is not specified, the alignment is applied to all columns.\n\nParameters\n\n\n\n\n\n\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\nalign\nstr\nThe alignment to apply. Must be one of \"left\", \"center\", or \"right\".\n'left'\n\n\ncolumns\nSelectExpr\nThe columns to target. Can either be a single column name or a series of column names provided in a list. If None, the alignment is applied to all columns.\nNone\n\n\n\n\n\nReturns\n\n\n\nType\nDescription\n\n\n\n\nGT\nThe GT object is returned. This is the same object that the method is called on so that we can facilitate method chaining.\n\n\n\n\n\nExamples\nLet’s use the countrypops to create a small table. We can change the alignment of the population column with cols_align(). In this example, the column label and body cells of population will be aligned to the left.\n\nfrom great_tables import GT\nfrom great_tables.data import countrypops\n\ncountrypops_mini = countrypops.loc[countrypops[\"country_name\"] == \"San Marino\"][\n [\"country_name\", \"year\", \"population\"]\n].tail(5)\n\n(\n GT(countrypops_mini, rowname_col=\"year\", groupname_col=\"country_name\")\n .cols_align(align=\"left\", columns=\"population\")\n)\n\n\n\n\n\n\n\n \n population\n\n\n\n \n San Marino\n \n \n 2018\n 34156\n \n \n 2019\n 34178\n \n \n 2020\n 34007\n \n \n 2021\n 33745\n \n \n 2022\n 33660\n \n\n\n\n\n\n\n \n\n\n\n\n\ncols_hide\nGT.cols_hide(self, columns)\nHide one or more columns.\nThe cols_hide() method allows us to hide one or more columns from appearing in the final output table. While it’s possible and often desirable to omit columns from the input table data before introduction to the GT() class, there can be cases where the data in certain columns is useful (as a column reference during formatting of other columns) but the final display of those columns is not necessary.\n\nParameters\n\n\n\n\n\n\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\ncolumns\nSelectExpr\nThe columns to hide in the output display table. Can either be a single column name or a series of column names provided in a list.\nrequired\n\n\n\n\n\nReturns\n\n\n\nType\nDescription\n\n\n\n\nGT\nThe GT object is returned. This is the same object that the method is called on so that we can facilitate method chaining.\n\n\n\n\n\nExamples\nFor this example, we’ll use a portion of the countrypops dataset to create a simple table. Let’s hide the year column with the cols_hide() method.\n\nfrom great_tables import GT\nfrom great_tables.data import countrypops\n\ncountrypops_mini = countrypops.loc[countrypops[\"country_name\"] == \"Benin\"][\n [\"country_name\", \"year\", \"population\"]\n].tail(5)\n\nGT(countrypops_mini).cols_hide(columns=\"year\")\n\n\n\n\n\n\n\n country_name\n population\n\n\n\n \n Benin\n 11940683\n \n \n Benin\n 12290444\n \n \n Benin\n 12643123\n \n \n Benin\n 12996895\n \n \n Benin\n 13352864\n \n\n\n\n\n\n\n \n\n\n\n\nDetails\nThe hiding of columns is internally a rendering directive, so, all columns that are ‘hidden’ are still accessible and useful in any expression provided to a rows argument. Furthermore, the cols_hide() method (as with many of the methods available in Great Tables) can be placed anywhere in a chain of calls (acting as a promise to hide columns when the timing is right). However there’s perhaps greater readability when placing this call closer to the end of such a chain. The cols_hide() method quietly changes the visible state of a column and doesn’t yield warnings when changing the state of already-invisible columns.\n\n\n\ncols_label\nGT.cols_label(self, cases=None, **kwargs)\nRelabel one or more columns.\nThere are three important pieces to labelling:\n\nEach argument has the form: {name in data} = {new label}.\nMultiple columns may be given the same label.\nLabels may use curly braces to apply special formatting, called unit notation. For example, “area ({{ft^2}})” would appear as “area (ft²)”.\n\nSee define_units() for details on unit notation.\n\nParameters\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\ncases\ndict[str, str | Text] | None\nA dictionary where the keys are column names and the values are the labels. Labels may use md() or html() helpers for formatting.\nNone\n\n\n**kwargs\nstr | Text\nKeyword arguments to specify column labels. Each keyword corresponds to a column name, with its value indicating the new label.\n{}\n\n\n\n\n\nReturns\n\n\n\nType\nDescription\n\n\n\n\nGT\nThe GT object is returned. This is the same object that the method is called on so that we can facilitate method chaining.\n\n\n\n\n\nNotes\nGT always selects columns using their name in the underlying data. This means that a column’s label is purely for final presentation.\n\n\nExamples\nThe example below relabels columns from the countrypops data to start with uppercase.\n\nfrom great_tables import GT\nfrom great_tables.data import countrypops\n\ncountrypops_mini = countrypops.loc[countrypops[\"country_name\"] == \"Uganda\"][\n [\"country_name\", \"year\", \"population\"]\n].tail(5)\n\n(\n GT(countrypops_mini)\n .cols_label(\n country_name=\"Country Name\",\n year=\"Year\",\n population=\"Population\"\n )\n)\n\n\n\n\n\n\n\n Country Name\n Year\n Population\n\n\n\n \n Uganda\n 2018\n 41515395\n \n \n Uganda\n 2019\n 42949080\n \n \n Uganda\n 2020\n 44404611\n \n \n Uganda\n 2021\n 45853778\n \n \n Uganda\n 2022\n 47249585\n \n\n\n\n\n\n\n \n\n\nNote that we supplied the name of the column as the key, and the new label as the value.\nWe can also use Markdown formatting for the column labels. In this example, we’ll use md(\"*Population*\") to make the label italicized.\n\nfrom great_tables import GT, md\nfrom great_tables.data import countrypops\n\n(\n GT(countrypops_mini)\n .cols_label(\n country_name=\"Name\",\n year=\"Year\",\n population=md(\"*Population*\")\n )\n)\n\n\n\n\n\n\n\n Name\n Year\n Population\n\n\n\n \n Uganda\n 2018\n 41515395\n \n \n Uganda\n 2019\n 42949080\n \n \n Uganda\n 2020\n 44404611\n \n \n Uganda\n 2021\n 45853778\n \n \n Uganda\n 2022\n 47249585\n \n\n\n\n\n\n\n \n\n\nWe can also use unit notation to format the column labels. In this example, we’ll use {cm^3 molecules^-1 s^-1} for part of the label for the OH_k298 column.\n\nfrom great_tables import GT\nfrom great_tables.data import reactions\nimport polars as pl\n\nreactions_mini = (\n pl.from_pandas(reactions)\n .filter(pl.col(\"cmpd_type\") == \"mercaptan\")\n .select([\"cmpd_name\", \"OH_k298\"])\n)\n\n(\n GT(reactions_mini)\n .fmt_scientific(\"OH_k298\")\n .sub_missing()\n .cols_label(\n cmpd_name=\"Compound Name\",\n OH_k298=\"OH, {{cm^3 molecules^-1 s^-1}}\",\n )\n)\n\n\n\n\n\n\n\n Compound Name\n OH, cm3 molecules−1 s−1\n\n\n\n \n methanethiol\n 3.50 × 10−11\n \n \n ethanethiol\n 4.50 × 10−11\n \n \n propanethiol\n 5.30 × 10−11\n \n \n 2-propanethiol\n 3.90 × 10−11\n \n \n 1-butanethiol\n 5.60 × 10−11\n \n \n 2-methyl-1-propanethiol\n 4.60 × 10−11\n \n \n 2-butanethiol\n 3.80 × 10−11\n \n \n t-butylsulfide\n 2.90 × 10−11\n \n \n 2-methylbutanethiol\n 5.20 × 10−11\n \n \n n-pentanethiol\n —\n \n \n 1,2-ethanedithiol\n 3.80 × 10−11\n \n\n\n\n\n\n\n \n\n\n\n\n\ncols_move\nGT.cols_move(self, columns, after)\nMove one or more columns.\nOn those occasions where you need to move columns this way or that way, we can make use of the cols_move() method. While it’s true that the movement of columns can be done upstream of Great Tables, it is much easier and less error prone to use the method provided here. The movement procedure here takes one or more specified columns (in the columns argument) and places them to the right of a different column (the after argument). The ordering of the columns to be moved is preserved, as is the ordering of all other columns in the table.\nThe columns supplied in columns must all exist in the table and none of them can be in the after argument. The after column must also exist and only one column should be provided here. If you need to place one more or columns at the beginning of the column series, the cols_move_to_start() method should be used. Similarly, if those columns to move should be placed at the end of the column series then use cols_move_to_end().\n\nParameters\n\n\n\n\n\n\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\ncolumns\nSelectExpr\nThe columns to target. Can either be a single column name or a series of column names provided in a list.\nrequired\n\n\nafter\nstr\nThe column after which the columns should be placed. This can be any column name that exists in the table.\nrequired\n\n\n\n\n\nReturns\n\n\n\nType\nDescription\n\n\n\n\nGT\nThe GT object is returned. This is the same object that the method is called on so that we can facilitate method chaining.\n\n\n\n\n\nExamples\nLet’s use the countrypops dataset to create a table. We’ll choose to position the population column after the country_name column by using the cols_move() method.\n\nfrom great_tables import GT\nfrom great_tables.data import countrypops\n\ncountrypops_mini = countrypops.loc[countrypops[\"country_name\"] == \"Japan\"][\n [\"country_name\", \"year\", \"population\"]\n].tail(5)\n\n(\n GT(countrypops_mini)\n .cols_move(\n columns=\"population\",\n after=\"country_name\"\n )\n)\n\n\n\n\n\n\n\n country_name\n population\n year\n\n\n\n \n Japan\n 126811000\n 2018\n \n \n Japan\n 126633000\n 2019\n \n \n Japan\n 126261000\n 2020\n \n \n Japan\n 125681593\n 2021\n \n \n Japan\n 125124989\n 2022\n \n\n\n\n\n\n\n \n\n\n\n\n\ncols_move_to_end\nGT.cols_move_to_end(self, columns)\nMove one or more columns to the end.\nWe can easily move set of columns to the beginning of the column series and we only need to specify which columns. It’s possible to do this upstream of Great Tables, however, it is easier with this method and it presents less possibility for error. The ordering of the columns that are moved to the end is preserved (same with the ordering of all other columns in the table).\n\nParameters\n\n\n\n\n\n\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\ncolumns\nSelectExpr\nThe columns to target. Can either be a single column name or a series of column names provided in a list.\nrequired\n\n\n\n\n\nReturns\n\n\n\nType\nDescription\n\n\n\n\nGT\nThe GT object is returned. This is the same object that the method is called on so that we can facilitate method chaining.\n\n\n\n\n\nExamples\nFor this example, we’ll use a portion of the countrypops dataset to create a simple table. Let’s move the year column, which is the middle column, to the end of the column series with the cols_move_to_end() method.\n\nfrom great_tables import GT\nfrom great_tables.data import countrypops\n\ncountrypops_mini = countrypops.loc[countrypops[\"country_name\"] == \"Benin\"][\n [\"country_name\", \"year\", \"population\"]\n].tail(5)\n\nGT(countrypops_mini).cols_move_to_end(columns=\"year\")\n\n\n\n\n\n\n\n country_name\n population\n year\n\n\n\n \n Benin\n 11940683\n 2018\n \n \n Benin\n 12290444\n 2019\n \n \n Benin\n 12643123\n 2020\n \n \n Benin\n 12996895\n 2021\n \n \n Benin\n 13352864\n 2022\n \n\n\n\n\n\n\n \n\n\nWe can also move multiple columns at a time. With the same countrypops-based table (countrypops_mini), let’s move both the year and country_name columns to the end of the column series.\n\nGT(countrypops_mini).cols_move_to_end(columns=[\"year\", \"country_name\"])\n\n\n\n\n\n\n\n population\n year\n country_name\n\n\n\n \n 11940683\n 2018\n Benin\n \n \n 12290444\n 2019\n Benin\n \n \n 12643123\n 2020\n Benin\n \n \n 12996895\n 2021\n Benin\n \n \n 13352864\n 2022\n Benin\n \n\n\n\n\n\n\n \n\n\n\n\n\ncols_move_to_start\nGT.cols_move_to_start(self, columns)\nMove one or more columns to the start.\nWe can easily move set of columns to the beginning of the column series and we only need to specify which columns. It’s possible to do this upstream of Great Tables, however, it is easier with this method and it presents less possibility for error. The ordering of the columns that are moved to the start is preserved (same with the ordering of all other columns in the table).\nThe columns supplied in columns must all exist in the table. If you need to place one or columns at the end of the column series, the cols_move_to_end() method should be used. More control is offered with the cols_move() method, where columns could be placed after a specific column.\n\nParameters\n\n\n\n\n\n\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\ncolumns\nSelectExpr\nThe columns to target. Can either be a single column name or a series of column names provided in a list.\nrequired\n\n\n\n\n\nReturns\n\n\n\nType\nDescription\n\n\n\n\nGT\nThe GT object is returned. This is the same object that the method is called on so that we can facilitate method chaining.\n\n\n\n\n\nExamples\nFor this example, we’ll use a portion of the countrypops dataset to create a simple table. Let’s move the year column, which is the middle column, to the start of the column series with the cols_move_to_start() method.\n\nfrom great_tables import GT\nfrom great_tables.data import countrypops\n\ncountrypops_mini = countrypops.loc[countrypops[\"country_name\"] == \"Fiji\"][\n [\"country_name\", \"year\", \"population\"]\n].tail(5)\n\nGT(countrypops_mini).cols_move_to_start(columns=\"year\")\n\n\n\n\n\n\n\n year\n country_name\n population\n\n\n\n \n 2018\n Fiji\n 918996\n \n \n 2019\n Fiji\n 918465\n \n \n 2020\n Fiji\n 920422\n \n \n 2021\n Fiji\n 924610\n \n \n 2022\n Fiji\n 929766\n \n\n\n\n\n\n\n \n\n\nWe can also move multiple columns at a time. With the same countrypops-based table (countrypops_mini), let’s move both the year and population columns to the start of the column series.\n\nGT(countrypops_mini).cols_move_to_start(columns=[\"year\", \"population\"])\n\n\n\n\n\n\n\n year\n population\n country_name\n\n\n\n \n 2018\n 918996\n Fiji\n \n \n 2019\n 918465\n Fiji\n \n \n 2020\n 920422\n Fiji\n \n \n 2021\n 924610\n Fiji\n \n \n 2022\n 929766\n Fiji\n \n\n\n\n\n\n\n \n\n\n\n\n\ncols_width\nGT.cols_width(self, cases=None, **kwargs)\nSet the widths of columns.\nManual specifications of column widths can be performed using the cols_width() method. We choose which columns get specific widths. This can be in units of pixels or as percentages. Width assignments are supplied inside of a dictionary where columns are the keys and the corresponding width is the value.\n\nParameters\n\n\n\n\n\n\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\ncases\ndict[str, str] | None\nA dictionary where the keys are column names and the values are the widths. Widths can be specified in pixels (e.g., \"50px\") or as percentages (e.g., \"20%\").\nNone\n\n\n**kwargs\nstr\nKeyword arguments to specify column widths. Each keyword corresponds to a column name, with its value indicating the width in pixels or percentages.\n{}\n\n\n\n\n\nReturns\n\n\n\nType\nDescription\n\n\n\n\nGT\nThe GT object is returned. This is the same object that the method is called on so that we can facilitate method chaining.\n\n\n\n\n\nExamples\nLet’s use select columns from the exibble dataset to create a new table. We can specify the widths of columns with cols_width(). This is done by specifying the exact widths for table columns in a dictionary. In this example, we’ll set the width of the num column to \"150px\", the char column to \"100px\", the date column to \"300px\". All other columns won’t be affected (their widths will be automatically set by their content).\n\nfrom great_tables import GT, exibble\n\nexibble_mini = exibble[[\"num\", \"char\", \"date\", \"datetime\", \"row\"]].head(5)\n\n(\n GT(exibble_mini)\n .cols_width(\n cases={\n \"num\": \"150px\",\n \"char\": \"100px\",\n \"date\": \"300px\"\n }\n )\n)\n\n\n\n\n\n \n \n \n \n \n\n\n\n\n\n num\n char\n date\n datetime\n row\n\n\n\n \n 0.1111\n apricot\n 2015-01-15\n 2018-01-01 02:22\n row_1\n \n \n 2.222\n banana\n 2015-02-15\n 2018-02-02 14:33\n row_2\n \n \n 33.33\n coconut\n 2015-03-15\n 2018-03-03 03:44\n row_3\n \n \n 444.4\n durian\n 2015-04-15\n 2018-04-04 15:55\n row_4\n \n \n 5550.0\n \n 2015-05-15\n 2018-05-05 04:00\n row_5\n \n\n\n\n\n\n\n \n\n\nWe can also specify the widths of columns as percentages. In this example, we’ll set the width of the num column to \"20%\", the char column to \"10%\", and the date column to \"30%\". Note that the percentages are relative and don’t need to sum to 100%.\n\n(\n GT(exibble_mini)\n .cols_width(\n cases={\n \"num\": \"20%\",\n \"char\": \"10%\",\n \"date\": \"30%\"\n }\n )\n)\n\n\n\n\n\n \n \n \n \n \n\n\n\n\n\n num\n char\n date\n datetime\n row\n\n\n\n \n 0.1111\n apricot\n 2015-01-15\n 2018-01-01 02:22\n row_1\n \n \n 2.222\n banana\n 2015-02-15\n 2018-02-02 14:33\n row_2\n \n \n 33.33\n coconut\n 2015-03-15\n 2018-03-03 03:44\n row_3\n \n \n 444.4\n durian\n 2015-04-15\n 2018-04-04 15:55\n row_4\n \n \n 5550.0\n \n 2015-05-15\n 2018-05-05 04:00\n row_5\n \n\n\n\n\n\n\n \n\n\nWe can also mix and match pixel and percentage widths. In this example, we’ll set the width of the num column to \"150px\", the char column to \"10%\", and the date column to \"30%\".\n\n(\n GT(exibble_mini)\n .cols_width(\n cases={\n \"num\": \"150px\",\n \"char\": \"10%\",\n \"date\": \"30%\"\n }\n )\n)\n\n\n\n\n\n \n \n \n \n \n\n\n\n\n\n num\n char\n date\n datetime\n row\n\n\n\n \n 0.1111\n apricot\n 2015-01-15\n 2018-01-01 02:22\n row_1\n \n \n 2.222\n banana\n 2015-02-15\n 2018-02-02 14:33\n row_2\n \n \n 33.33\n coconut\n 2015-03-15\n 2018-03-03 03:44\n row_3\n \n \n 444.4\n durian\n 2015-04-15\n 2018-04-04 15:55\n row_4\n \n \n 5550.0\n \n 2015-05-15\n 2018-05-05 04:00\n row_5\n \n\n\n\n\n\n\n \n\n\nIf we set the width of all columns, the table will be forced to use the specified widths (i.e., a column width less than the content width will be honored). In this next example, we’ll set widths for all columns. This is a good way to ensure that the widths you specify are fully respected (and not overridden by automatic width calculations).\n\n(\n GT(exibble_mini)\n .cols_width(\n cases={\n \"num\": \"30px\",\n \"char\": \"100px\",\n \"date\": \"100px\",\n \"datetime\": \"200px\",\n \"row\": \"50px\"\n }\n )\n)\n\n\n\n\n\n \n \n \n \n \n\n\n\n\n\n num\n char\n date\n datetime\n row\n\n\n\n \n 0.1111\n apricot\n 2015-01-15\n 2018-01-01 02:22\n row_1\n \n \n 2.222\n banana\n 2015-02-15\n 2018-02-02 14:33\n row_2\n \n \n 33.33\n coconut\n 2015-03-15\n 2018-03-03 03:44\n row_3\n \n \n 444.4\n durian\n 2015-04-15\n 2018-04-04 15:55\n row_4\n \n \n 5550.0\n \n 2015-05-15\n 2018-05-05 04:00\n row_5\n \n\n\n\n\n\n\n \n\n\nNotice that in the above example, the num column is very small (only 30px) and the content overflows. When not specifying the width of all columns, the table will automatically adjust the column widths based on the content (and you wouldn’t get the overflowing behavior seen in the previous example).\n\n\n\ndata_color\nGT.data_color(self, columns=None, rows=None, palette=None, domain=None, na_color=None, alpha=None, reverse=False, autocolor_text=True)\nPerform data cell colorization.\nIt’s possible to add color to data cells according to their values with the data_color() method. There is a multitude of ways to perform data cell colorizing here:\n\ntargeting: we can constrain which columns should receive the colorization treatment through the columns= argument)\ncolor palettes: with palette= we could supply a list of colors composed of hexadecimal values or color names\nvalue domain: we can either opt to have the range of values define the domain, or, specify one explicitly with the domain= argument\ntext autocoloring: data_color() will automatically recolor the foreground text to provide the best contrast (can be deactivated with autocolor_text=False)\n\n\nParameters\n\n\n\n\n\n\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\ncolumns\nSelectExpr\nThe columns to target. Can either be a single column name or a series of column names provided in a list.\nNone\n\n\nrows\nRowSelectExpr\nIn conjunction with columns=, we can specify which rows should be colored. By default, all rows in the targeted columns will be colored. Alternatively, we can provide a list of row indices.\nNone\n\n\npalette\nstr | list[str] | None\nThe color palette to use. This should be a list of colors (e.g., [\"#FF0000\", \"#00FF00\", \"#0000FF\"]). A ColorBrewer palette could also be used, just supply the name (reference available in the Color palette access from ColorBrewer section). If None, then a default palette will be used.\nNone\n\n\ndomain\nlist[str] | list[int] | list[float] | None\nThe domain of values to use for the color scheme. This can be a list of floats, integers, or strings. If None, then the domain will be inferred from the data values.\nNone\n\n\nna_color\nstr | None\nThe color to use for missing values. If None, then the default color (\"#808080\") will be used.\nNone\n\n\nalpha\nint | float | None\nAn optional, fixed alpha transparency value that will be applied to all color palette values.\nNone\n\n\nreverse\nbool\nShould the colors computed operate in the reverse order? If True then colors that normally change from red to blue will change in the opposite direction.\nFalse\n\n\nautocolor_text\nbool\nWhether or not to automatically color the text of the data values. If True, then the text will be colored according to the background color of the cell.\nTrue\n\n\n\n\n\nReturns\n\n\n\nType\nDescription\n\n\n\n\nGT\nThe GT object is returned. This is the same object that the method is called on so that we can facilitate method chaining.\n\n\n\n\n\nColor Palette Access From Colorbrewer And Viridis\nAll palettes from the ColorBrewer package can be accessed by providing the palette name in palette=. There are 35 available palettes:\n\n\n\n\nPalette Name\nColors\nCategory\nColorblind Friendly\n\n\n\n\n1\n\"BrBG\"\n11\nDiverging\nYes\n\n\n2\n\"PiYG\"\n11\nDiverging\nYes\n\n\n3\n\"PRGn\"\n11\nDiverging\nYes\n\n\n4\n\"PuOr\"\n11\nDiverging\nYes\n\n\n5\n\"RdBu\"\n11\nDiverging\nYes\n\n\n6\n\"RdYlBu\"\n11\nDiverging\nYes\n\n\n7\n\"RdGy\"\n11\nDiverging\nNo\n\n\n8\n\"RdYlGn\"\n11\nDiverging\nNo\n\n\n9\n\"Spectral\"\n11\nDiverging\nNo\n\n\n10\n\"Dark2\"\n8\nQualitative\nYes\n\n\n11\n\"Paired\"\n12\nQualitative\nYes\n\n\n12\n\"Set1\"\n9\nQualitative\nNo\n\n\n13\n\"Set2\"\n8\nQualitative\nYes\n\n\n14\n\"Set3\"\n12\nQualitative\nNo\n\n\n15\n\"Accent\"\n8\nQualitative\nNo\n\n\n16\n\"Pastel1\"\n9\nQualitative\nNo\n\n\n17\n\"Pastel2\"\n8\nQualitative\nNo\n\n\n18\n\"Blues\"\n9\nSequential\nYes\n\n\n19\n\"BuGn\"\n9\nSequential\nYes\n\n\n20\n\"BuPu\"\n9\nSequential\nYes\n\n\n21\n\"GnBu\"\n9\nSequential\nYes\n\n\n22\n\"Greens\"\n9\nSequential\nYes\n\n\n23\n\"Greys\"\n9\nSequential\nYes\n\n\n24\n\"Oranges\"\n9\nSequential\nYes\n\n\n25\n\"OrRd\"\n9\nSequential\nYes\n\n\n26\n\"PuBu\"\n9\nSequential\nYes\n\n\n27\n\"PuBuGn\"\n9\nSequential\nYes\n\n\n28\n\"PuRd\"\n9\nSequential\nYes\n\n\n29\n\"Purples\"\n9\nSequential\nYes\n\n\n30\n\"RdPu\"\n9\nSequential\nYes\n\n\n31\n\"Reds\"\n9\nSequential\nYes\n\n\n32\n\"YlGn\"\n9\nSequential\nYes\n\n\n33\n\"YlGnBu\"\n9\nSequential\nYes\n\n\n34\n\"YlOrBr\"\n9\nSequential\nYes\n\n\n35\n\"YlOrRd\"\n9\nSequential\nYes\n\n\n\nWe can also use the viridis and associated color palettes by providing to palette= any of the following string values: \"viridis\", \"plasma\", \"inferno\", \"magma\", or \"cividis\".\n\n\nExamples\nThe data_color() method can be used without any supplied arguments to colorize a table. Let’s do this with the exibble dataset:\n\nfrom great_tables import GT\nfrom great_tables.data import exibble\n\nGT(exibble).data_color()\n\n\n\n\n\n\n\n num\n char\n fctr\n date\n time\n datetime\n currency\n row\n group\n\n\n\n \n 0.1111\n apricot\n one\n 2015-01-15\n 13:35\n 2018-01-01 02:22\n 49.95\n row_1\n grp_a\n \n \n 2.222\n banana\n two\n 2015-02-15\n 14:40\n 2018-02-02 14:33\n 17.95\n row_2\n grp_a\n \n \n 33.33\n coconut\n three\n 2015-03-15\n 15:45\n 2018-03-03 03:44\n 1.39\n row_3\n grp_a\n \n \n 444.4\n durian\n four\n 2015-04-15\n 16:50\n 2018-04-04 15:55\n 65100.0\n row_4\n grp_a\n \n \n 5550.0\n \n five\n 2015-05-15\n 17:55\n 2018-05-05 04:00\n 1325.81\n row_5\n grp_b\n \n \n \n fig\n six\n 2015-06-15\n \n 2018-06-06 16:11\n 13.255\n row_6\n grp_b\n \n \n 777000.0\n grapefruit\n seven\n \n 19:10\n 2018-07-07 05:22\n \n row_7\n grp_b\n \n \n 8880000.0\n honeydew\n eight\n 2015-08-15\n 20:20\n \n 0.44\n row_8\n grp_b\n \n\n\n\n\n\n\n \n\n\nWhat’s happened is that data_color() applies background colors to all cells of every column with the palette of eight colors. Numeric columns will use ‘numeric’ methodology for color scaling whereas string-based columns will use the ‘factor’ methodology. The text color undergoes an automatic modification that maximizes contrast (since autocolor_text=True by default).\nWe can target specific colors and apply color to just those columns. Let’s do that and also supply palette= values of \"red\" and \"green\".\n\nGT(exibble).data_color(\n columns=[\"num\", \"currency\"],\n palette=[\"red\", \"green\"]\n)\n\n\n\n\n\n\n\n num\n char\n fctr\n date\n time\n datetime\n currency\n row\n group\n\n\n\n \n 0.1111\n apricot\n one\n 2015-01-15\n 13:35\n 2018-01-01 02:22\n 49.95\n row_1\n grp_a\n \n \n 2.222\n banana\n two\n 2015-02-15\n 14:40\n 2018-02-02 14:33\n 17.95\n row_2\n grp_a\n \n \n 33.33\n coconut\n three\n 2015-03-15\n 15:45\n 2018-03-03 03:44\n 1.39\n row_3\n grp_a\n \n \n 444.4\n durian\n four\n 2015-04-15\n 16:50\n 2018-04-04 15:55\n 65100.0\n row_4\n grp_a\n \n \n 5550.0\n \n five\n 2015-05-15\n 17:55\n 2018-05-05 04:00\n 1325.81\n row_5\n grp_b\n \n \n \n fig\n six\n 2015-06-15\n \n 2018-06-06 16:11\n 13.255\n row_6\n grp_b\n \n \n 777000.0\n grapefruit\n seven\n \n 19:10\n 2018-07-07 05:22\n \n row_7\n grp_b\n \n \n 8880000.0\n honeydew\n eight\n 2015-08-15\n 20:20\n \n 0.44\n row_8\n grp_b\n \n\n\n\n\n\n\n \n\n\nWith those options in place we see that only the numeric columns num and currency received color treatments. Moreover, the palette colors were mapped to the lower and upper limits of the data in each column; interpolated colors were used for the values in between the numeric limits of the two columns.\nWe can manually set the limits of the data with the domain= argument (which is preferable in most cases). Let’s colorize just the currency column and set domain=[0, 50]. Any values that are either missing or lie outside of the domain will be colorized with the na_color= color (so we’ll set that to \"lightgray\").\n\nGT(exibble).data_color(\n columns=\"currency\",\n palette=[\"red\", \"green\"],\n domain=[0, 50],\n na_color=\"lightgray\"\n)\n\n\n\n\n\n\n\n num\n char\n fctr\n date\n time\n datetime\n currency\n row\n group\n\n\n\n \n 0.1111\n apricot\n one\n 2015-01-15\n 13:35\n 2018-01-01 02:22\n 49.95\n row_1\n grp_a\n \n \n 2.222\n banana\n two\n 2015-02-15\n 14:40\n 2018-02-02 14:33\n 17.95\n row_2\n grp_a\n \n \n 33.33\n coconut\n three\n 2015-03-15\n 15:45\n 2018-03-03 03:44\n 1.39\n row_3\n grp_a\n \n \n 444.4\n durian\n four\n 2015-04-15\n 16:50\n 2018-04-04 15:55\n 65100.0\n row_4\n grp_a\n \n \n 5550.0\n \n five\n 2015-05-15\n 17:55\n 2018-05-05 04:00\n 1325.81\n row_5\n grp_b\n \n \n \n fig\n six\n 2015-06-15\n \n 2018-06-06 16:11\n 13.255\n row_6\n grp_b\n \n \n 777000.0\n grapefruit\n seven\n \n 19:10\n 2018-07-07 05:22\n \n row_7\n grp_b\n \n \n 8880000.0\n honeydew\n eight\n 2015-08-15\n 20:20\n \n 0.44\n row_8\n grp_b\n \n\n\n\n\n\n\n \n\n\n\n\n\nfmt\nGT.fmt(self, fns, columns=None, rows=None, is_substitution=False)\nSet a column format with a formatter function.\nThe fmt() method provides a way to execute custom formatting functionality with raw data values in a way that can consider all output contexts.\nAlong with the columns and rows arguments that provide some precision in targeting data cells, the fns argument allows you to define one or more functions for manipulating the raw data.\n\nParameters\n\n\n\n\n\n\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\nfns\nFormatFn | FormatFns\nEither a single formatting function or a named list of functions.\nrequired\n\n\ncolumns\nSelectExpr\nThe columns to target. Can either be a single column name or a series of column names provided in a list.\nNone\n\n\nrows\nint | list[int] | None\nIn conjunction with columns=, we can specify which of their rows should undergo formatting. The default is all rows, resulting in all rows in columns being formatted. Alternatively, we can supply a list of row indices.\nNone\n\n\nis_substitution\nbool\nWhether the formatter is a substitution. Substitutions are run last, after other formatters.\nFalse\n\n\n\n\n\nReturns\n\n\n\nType\nDescription\n\n\n\n\nGT\nThe GT object is returned. This is the same object that the method is called on so that we can facilitate method chaining.\n\n\n\n\n\nExamples\nLet’s use the exibble dataset to create a table. With the fmt() method, we’ll add a prefix ^ and a suffix $ to the row and group columns.\n\nfrom great_tables import GT, exibble\n\n(\n GT(exibble)\n .fmt(lambda x: f\"^{x}$\", columns=[\"row\", \"group\"])\n)\n\n\n\n\n\n\n\n num\n char\n fctr\n date\n time\n datetime\n currency\n row\n group\n\n\n\n \n 0.1111\n apricot\n one\n 2015-01-15\n 13:35\n 2018-01-01 02:22\n 49.95\n ^row_1$\n ^grp_a$\n \n \n 2.222\n banana\n two\n 2015-02-15\n 14:40\n 2018-02-02 14:33\n 17.95\n ^row_2$\n ^grp_a$\n \n \n 33.33\n coconut\n three\n 2015-03-15\n 15:45\n 2018-03-03 03:44\n 1.39\n ^row_3$\n ^grp_a$\n \n \n 444.4\n durian\n four\n 2015-04-15\n 16:50\n 2018-04-04 15:55\n 65100.0\n ^row_4$\n ^grp_a$\n \n \n 5550.0\n \n five\n 2015-05-15\n 17:55\n 2018-05-05 04:00\n 1325.81\n ^row_5$\n ^grp_b$\n \n \n \n fig\n six\n 2015-06-15\n \n 2018-06-06 16:11\n 13.255\n ^row_6$\n ^grp_b$\n \n \n 777000.0\n grapefruit\n seven\n \n 19:10\n 2018-07-07 05:22\n \n ^row_7$\n ^grp_b$\n \n \n 8880000.0\n honeydew\n eight\n 2015-08-15\n 20:20\n \n 0.44\n ^row_8$\n ^grp_b$\n \n\n\n\n\n\n\n \n\n\n\n\n\nfmt_bytes\nGT.fmt_bytes(self, columns=None, rows=None, standard='decimal', decimals=1, n_sigfig=None, drop_trailing_zeros=True, drop_trailing_dec_mark=True, use_seps=True, pattern='{x}', sep_mark=',', dec_mark='.', force_sign=False, incl_space=True, locale=None)\nFormat values as bytes.\nWith numeric values in a table, we can transform those to values of bytes with human readable units. The fmt_bytes() method allows for the formatting of byte sizes to either of two common representations: (1) with decimal units (powers of 1000, examples being \"kB\" and \"MB\"), and (2) with binary units (powers of 1024, examples being \"KiB\" and \"MiB\"). It is assumed the input numeric values represent the number of bytes and automatic truncation of values will occur. The numeric values will be scaled to be in the range of 1 to <1000 and then decorated with the correct unit symbol according to the standard chosen. For more control over the formatting of byte sizes, we can use the following options:\n\ndecimals: choice of the number of decimal places, option to drop trailing zeros, and a choice of the decimal symbol\ndigit grouping separators: options to enable/disable digit separators and provide a choice of separator symbol\npattern: option to use a text pattern for decoration of the formatted values\nlocale-based formatting: providing a locale ID will result in number formatting specific to the chosen locale\n\n\nParameters\n\n\n\n\n\n\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\ncolumns\nSelectExpr\nThe columns to target. Can either be a single column name or a series of column names provided in a list.\nNone\n\n\nrows\nint | list[int] | None\nIn conjunction with columns=, we can specify which of their rows should undergo formatting. The default is all rows, resulting in all rows in targeted columns being formatted. Alternatively, we can supply a list of row indices.\nNone\n\n\nstandard\nstr\nThe form of expressing large byte sizes is divided between: (1) decimal units (powers of 1000; e.g., \"kB\" and \"MB\"), and (2) binary units (powers of 1024; e.g., \"KiB\" and \"MiB\"). The default is to use decimal units with the \"decimal\" option. The alternative is to use binary units with the \"binary\" option.\n'decimal'\n\n\ndecimals\nint\nThis corresponds to the exact number of decimal places to use. A value such as 2.34 can, for example, be formatted with 0 decimal places and it would result in \"2\". With 4 decimal places, the formatted value becomes \"2.3400\". The trailing zeros can be removed with drop_trailing_zeros=True.\n1\n\n\ndrop_trailing_zeros\nbool\nA boolean value that allows for removal of trailing zeros (those redundant zeros after the decimal mark).\nTrue\n\n\ndrop_trailing_dec_mark\nbool\nA boolean value that determines whether decimal marks should always appear even if there are no decimal digits to display after formatting (e.g., 23 becomes 23. if False). By default trailing decimal marks are not shown.\nTrue\n\n\nuse_seps\nbool\nThe use_seps option allows for the use of digit group separators. The type of digit group separator is set by sep_mark and overridden if a locale ID is provided to locale. This setting is True by default.\nTrue\n\n\npattern\nstr\nA formatting pattern that allows for decoration of the formatted value. The formatted value is represented by the {x} (which can be used multiple times, if needed) and all other characters will be interpreted as string literals.\n'{x}'\n\n\nsep_mark\nstr\nThe string to use as a separator between groups of digits. For example, using sep_mark=\",\" with a value of 1000 would result in a formatted value of \"1,000\". This argument is ignored if a locale is supplied (i.e., is not None).\n','\n\n\ndec_mark\nstr\nThe string to be used as the decimal mark. For example, using dec_mark=\",\" with the value 0.152 would result in a formatted value of \"0,152\"). This argument is ignored if a locale is supplied (i.e., is not None).\n'.'\n\n\nforce_sign\nbool\nShould the positive sign be shown for positive values (effectively showing a sign for all values except zero)? If so, use True for this option. The default is False, where only negative numbers will display a minus sign.\nFalse\n\n\nincl_space\nbool\nAn option for whether to include a space between the value and the currency symbol. The default is to not introduce a space character.\nTrue\n\n\nlocale\nstr | None\nAn optional locale identifier that can be used for formatting values according the locale’s rules. Examples include \"en\" for English (United States) and \"fr\" for French (France).\nNone\n\n\n\n\n\nReturns\n\n\n\nType\nDescription\n\n\n\n\nGT\nThe GT object is returned. This is the same object that the method is called on so that we can facilitate method chaining.\n\n\n\n\n\nAdapting Output To A Specific Locale\nThis formatting method can adapt outputs according to a provided locale value. Examples include \"en\" for English (United States) and \"fr\" for French (France). The use of a valid locale ID here means separator and decimal marks will be correct for the given locale. Should any values be provided in sep_mark or dec_mark, they will be overridden by the locale’s preferred values.\nNote that a locale value provided here will override any global locale setting performed in GT()’s own locale argument (it is settable there as a value received by all other methods that have a locale argument).\n\n\nExamples\nLet’s use a single column from the exibble dataset and create a new table. We’ll format the num column to display as byte sizes in the decimal standard through use of the fmt_bytes() method.\n\nfrom great_tables import GT, exibble\n\n(\n GT(exibble[[\"num\"]])\n .fmt_bytes(columns=\"num\", standard=\"decimal\")\n)\n\n\n\n\n\n\n\n num\n\n\n\n \n 0 B\n \n \n 2 B\n \n \n 33 B\n \n \n 444 B\n \n \n 5.5 kB\n \n \n \n \n \n 777 kB\n \n \n 8.9 MB\n \n\n\n\n\n\n\n \n\n\n\n\nSee Also\nThe functional version of this method, val_fmt_bytes(), allows you to format a single numerical value (or a list of them).\n\n\n\nfmt_currency\nGT.fmt_currency(self, columns=None, rows=None, currency=None, use_subunits=True, decimals=None, drop_trailing_dec_mark=True, use_seps=True, scale_by=1, pattern='{x}', sep_mark=',', dec_mark='.', force_sign=False, placement='left', incl_space=False, locale=None)\nFormat values as currencies.\nWith numeric values in a gt table, we can perform currency-based formatting with the fmt_currency() method. This supports both automatic formatting with a three-letter currency code. We have fine control over the conversion from numeric values to currency values, where we could take advantage of the following options:\n\nthe currency: providing a currency code or common currency name will procure the correct currency symbol and number of currency subunits\ncurrency symbol placement: the currency symbol can be placed before or after the values\ndecimals/subunits: choice of the number of decimal places, and a choice of the decimal symbol, and an option on whether to include or exclude the currency subunits (the decimal portion)\ndigit grouping separators: options to enable/disable digit separators and provide a choice of separator symbol\nscaling: we can choose to scale targeted values by a multiplier value\npattern: option to use a text pattern for decoration of the formatted currency values\nlocale-based formatting: providing a locale ID will result in currency formatting specific to the chosen locale; it will also retrieve the locale’s currency if none is explicitly given\n\n\nParameters\n\n\n\n\n\n\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\ncolumns\nSelectExpr\nThe columns to target. Can either be a single column name or a series of column names provided in a list.\nNone\n\n\nrows\nint | list[int] | None\nIn conjunction with columns=, we can specify which of their rows should undergo formatting. The default is all rows, resulting in all rows in targeted columns being formatted. Alternatively, we can supply a list of row indices.\nNone\n\n\ncurrency\nstr | None\nThe currency to use for the numeric value. This input can be supplied as a 3-letter currency code (e.g., \"USD\" for U.S. Dollars, \"EUR\" for the Euro currency).\nNone\n\n\nuse_subunits\nbool\nAn option for whether the subunits portion of a currency value should be displayed. For example, with an input value of 273.81, the default formatting will produce \"$273.81\". Removing the subunits (with use_subunits = False) will give us \"$273\".\nTrue\n\n\ndecimals\nint | None\nThe decimals values corresponds to the exact number of decimal places to use. This value is optional as a currency has an intrinsic number of decimal places (i.e., the subunits). A value such as 2.34 can, for example, be formatted with 0 decimal places and if the currency used is \"USD\" it would result in \"$2\". With 4 decimal places, the formatted value becomes \"$2.3400\".\nNone\n\n\ndrop_trailing_dec_mark\nbool\nA boolean value that determines whether decimal marks should always appear even if there are no decimal digits to display after formatting (e.g., 23 becomes 23. if False). By default trailing decimal marks are not shown.\nTrue\n\n\nuse_seps\nbool\nThe use_seps option allows for the use of digit group separators. The type of digit group separator is set by sep_mark and overridden if a locale ID is provided to locale. This setting is True by default.\nTrue\n\n\nscale_by\nfloat\nAll numeric values will be multiplied by the scale_by value before undergoing formatting. Since the default value is 1, no values will be changed unless a different multiplier value is supplied.\n1\n\n\npattern\nstr\nA formatting pattern that allows for decoration of the formatted value. The formatted value is represented by the {x} (which can be used multiple times, if needed) and all other characters will be interpreted as string literals.\n'{x}'\n\n\nsep_mark\nstr\nThe string to use as a separator between groups of digits. For example, using sep_mark=\",\" with a value of 1000 would result in a formatted value of \"1,000\". This argument is ignored if a locale is supplied (i.e., is not None).\n','\n\n\ndec_mark\nstr\nThe string to be used as the decimal mark. For example, using dec_mark=\",\" with the value 0.152 would result in a formatted value of \"0,152\"). This argument is ignored if a locale is supplied (i.e., is not None).\n'.'\n\n\nforce_sign\nbool\nShould the positive sign be shown for positive values (effectively showing a sign for all values except zero)? If so, use True for this option. The default is False, where only negative numbers will display a minus sign.\nFalse\n\n\nplacement\nstr\nThe placement of the currency symbol. This can be either be \"left\" (as in \"$450\") or \"right\" (which yields \"450$\").\n'left'\n\n\nincl_space\nbool\nAn option for whether to include a space between the value and the currency symbol. The default is to not introduce a space character.\nFalse\n\n\nlocale\nstr | None\nAn optional locale identifier that can be used for formatting values according the locale’s rules. Examples include \"en\" for English (United States) and \"fr\" for French (France).\nNone\n\n\n\n\n\nReturns\n\n\n\nType\nDescription\n\n\n\n\nGT\nThe GT object is returned. This is the same object that the method is called on so that we can facilitate method chaining.\n\n\n\n\n\nAdapting Output To A Specific Locale\nThis formatting method can adapt outputs according to a provided locale value. Examples include \"en\" for English (United States) and \"fr\" for French (France). The use of a valid locale ID here means separator and decimal marks will be correct for the given locale. Should any values be provided in sep_mark or dec_mark, they will be overridden by the locale’s preferred values. In addition to number formatting, providing a locale value and not providing a currency allows Great Tables to obtain the currency code from the locale’s territory.\nNote that a locale value provided here will override any global locale setting performed in GT()’s own locale argument (it is settable there as a value received by all other methods that have a locale argument).\n\n\nExamples\nLet’s use the exibble dataset to create a table. With the fmt_currency() method, we’ll format the currency column to display monetary values.\n\nfrom great_tables import GT, exibble\n\n(\n GT(exibble)\n .fmt_currency(\n columns=\"currency\",\n decimals=3,\n use_seps=False\n )\n)\n\n\n\n\n\n\n\n num\n char\n fctr\n date\n time\n datetime\n currency\n row\n group\n\n\n\n \n 0.1111\n apricot\n one\n 2015-01-15\n 13:35\n 2018-01-01 02:22\n $49.950\n row_1\n grp_a\n \n \n 2.222\n banana\n two\n 2015-02-15\n 14:40\n 2018-02-02 14:33\n $17.950\n row_2\n grp_a\n \n \n 33.33\n coconut\n three\n 2015-03-15\n 15:45\n 2018-03-03 03:44\n $1.390\n row_3\n grp_a\n \n \n 444.4\n durian\n four\n 2015-04-15\n 16:50\n 2018-04-04 15:55\n $65100.000\n row_4\n grp_a\n \n \n 5550.0\n \n five\n 2015-05-15\n 17:55\n 2018-05-05 04:00\n $1325.810\n row_5\n grp_b\n \n \n \n fig\n six\n 2015-06-15\n \n 2018-06-06 16:11\n $13.255\n row_6\n grp_b\n \n \n 777000.0\n grapefruit\n seven\n \n 19:10\n 2018-07-07 05:22\n \n row_7\n grp_b\n \n \n 8880000.0\n honeydew\n eight\n 2015-08-15\n 20:20\n \n $0.440\n row_8\n grp_b\n \n\n\n\n\n\n\n \n\n\n\n\nSee Also\nThe functional version of this method, val_fmt_currency(), allows you to format a single numerical value (or a list of them).\n\n\n\nfmt_date\nGT.fmt_date(self, columns=None, rows=None, date_style='iso', pattern='{x}', locale=None)\nFormat values as dates.\nFormat input values to time values using one of 17 preset date styles. Input can be in the form of date type or as a ISO-8601 string (in the form of YYYY-MM-DD HH:MM:SS or YYYY-MM-DD).\n\nParameters\n\n\n\n\n\n\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\ncolumns\nSelectExpr\nThe columns to target. Can either be a single column name or a series of column names provided in a list.\nNone\n\n\nrows\nint | list[int] | None\nIn conjunction with columns=, we can specify which of their rows should undergo formatting. The default is all rows, resulting in all rows in targeted columns being formatted. Alternatively, we can supply a list of row indices.\nNone\n\n\ndate_style\nDateStyle\nThe date style to use. By default this is the short name \"iso\" which corresponds to ISO 8601 date formatting. There are 41 date styles in total and their short names can be viewed using info_date_style().\n'iso'\n\n\npattern\nstr\nA formatting pattern that allows for decoration of the formatted value. The formatted value is represented by the {x} (which can be used multiple times, if needed) and all other characters will be interpreted as string literals.\n'{x}'\n\n\nlocale\nstr | None\nAn optional locale identifier that can be used for formatting values according the locale’s rules. Examples include \"en\" for English (United States) and \"fr\" for French (France).\nNone\n\n\n\n\n\nFormatting With The Date_Style Argument\nWe need to supply a preset date style to the date_style argument. The date styles are numerous and can handle localization to any supported locale. The following table provides a listing of all date styles and their output values (corresponding to an input date of 2000-02-29).\n\n\n\n\nDate Style\nOutput\n\n\n\n\n1\n\"iso\"\n\"2000-02-29\"\n\n\n2\n\"wday_month_day_year\"\n\"Tuesday, February 29, 2000\"\n\n\n3\n\"wd_m_day_year\"\n\"Tue, Feb 29, 2000\"\n\n\n4\n\"wday_day_month_year\"\n\"Tuesday 29 February 2000\"\n\n\n5\n\"month_day_year\"\n\"February 29, 2000\"\n\n\n6\n\"m_day_year\"\n\"Feb 29, 2000\"\n\n\n7\n\"day_m_year\"\n\"29 Feb 2000\"\n\n\n8\n\"day_month_year\"\n\"29 February 2000\"\n\n\n9\n\"day_month\"\n\"29 February\"\n\n\n10\n\"day_m\"\n\"29 Feb\"\n\n\n11\n\"year\"\n\"2000\"\n\n\n12\n\"month\"\n\"February\"\n\n\n13\n\"day\"\n\"29\"\n\n\n14\n\"year.mn.day\"\n\"2000/02/29\"\n\n\n15\n\"y.mn.day\"\n\"00/02/29\"\n\n\n16\n\"year_week\"\n\"2000-W09\"\n\n\n17\n\"year_quarter\"\n\"2000-Q1\"\n\n\n\nWe can use the info_date_style() function within the console to view a similar table of date styles with example output.\n\n\nReturns\n\n\n\nType\nDescription\n\n\n\n\nGT\nThe GT object is returned. This is the same object that the method is called on so that we can facilitate method chaining.\n\n\n\n\n\nAdapting Output To A Specific Locale\nThis formatting method can adapt outputs according to a provided locale value. Examples include \"en\" for English (United States) and \"fr\" for French (France). Note that a locale value provided here will override any global locale setting performed in GT()’s own locale argument (it is settable there as a value received by all other methods that have a locale argument).\n\n\nExamples\nLet’s use the exibble dataset to create a simple, two-column table (keeping only the date and time columns). With the fmt_date() method, we’ll format the date column to display dates formatted with the \"month_day_year\" date style.\n\nfrom great_tables import GT, exibble\n\nexibble_mini = exibble[[\"date\", \"time\"]]\n\n(\n GT(exibble_mini)\n .fmt_date(columns=\"date\", date_style=\"month_day_year\")\n)\n\n\n\n\n\n\n\n date\n time\n\n\n\n \n January 15, 2015\n 13:35\n \n \n February 15, 2015\n 14:40\n \n \n March 15, 2015\n 15:45\n \n \n April 15, 2015\n 16:50\n \n \n May 15, 2015\n 17:55\n \n \n June 15, 2015\n \n \n \n \n 19:10\n \n \n August 15, 2015\n 20:20\n \n\n\n\n\n\n\n \n\n\n\n\nSee Also\nThe functional version of this method, val_fmt_date(), allows you to format a single numerical value (or a list of them).\n\n\n\nfmt_datetime\nGT.fmt_datetime(self, columns=None, rows=None, date_style='iso', time_style='iso', sep=' ', pattern='{x}', locale=None)\nFormat values as datetimes.\nFormat input values to datetime values using one of 17 preset date styles and one of 5 preset time styles. Input can be in the form of datetime values, or strings in the ISO 8601 forms of YYYY-MM-DD HH:MM:SS or YYYY-MM-DD.\n\nParameters\n\n\n\n\n\n\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\ncolumns\nSelectExpr\nThe columns to target. Can either be a single column name or a series of column names provided in a list.\nNone\n\n\nrows\nint | list[int] | None\nIn conjunction with columns=, we can specify which of their rows should undergo formatting. The default is all rows, resulting in all rows in targeted columns being formatted. Alternatively, we can supply a list of row indices.\nNone\n\n\ndate_style\nDateStyle\nThe date style to use. By default this is the short name \"iso\" which corresponds to ISO 8601 date formatting. There are 41 date styles in total and their short names can be viewed using info_date_style().\n'iso'\n\n\ntime_style\nTimeStyle\nThe time style to use. By default this is the short name \"iso\" which corresponds to how times are formatted within ISO 8601 datetime values. There are 5 time styles in total and their short names can be viewed using info_time_style().\n'iso'\n\n\n\n\n\nFormatting With The Date_Style And Time_Style Arguments\nWe need to supply a preset date style to the date_style argument and a preset time style to the time_style argument. The date styles are numerous and can handle localization to any supported locale. The following table provides a listing of all date styles and their output values (corresponding to an input date of 2000-02-29 14:35:00).\n\n\n\n\nDate Style\nOutput\n\n\n\n\n1\n\"iso\"\n\"2000-02-29\"\n\n\n2\n\"wday_month_day_year\"\n\"Tuesday, February 29, 2000\"\n\n\n3\n\"wd_m_day_year\"\n\"Tue, Feb 29, 2000\"\n\n\n4\n\"wday_day_month_year\"\n\"Tuesday 29 February 2000\"\n\n\n5\n\"month_day_year\"\n\"February 29, 2000\"\n\n\n6\n\"m_day_year\"\n\"Feb 29, 2000\"\n\n\n7\n\"day_m_year\"\n\"29 Feb 2000\"\n\n\n8\n\"day_month_year\"\n\"29 February 2000\"\n\n\n9\n\"day_month\"\n\"29 February\"\n\n\n10\n\"day_m\"\n\"29 Feb\"\n\n\n11\n\"year\"\n\"2000\"\n\n\n12\n\"month\"\n\"February\"\n\n\n13\n\"day\"\n\"29\"\n\n\n14\n\"year.mn.day\"\n\"2000/02/29\"\n\n\n15\n\"y.mn.day\"\n\"00/02/29\"\n\n\n16\n\"year_week\"\n\"2000-W09\"\n\n\n17\n\"year_quarter\"\n\"2000-Q1\"\n\n\n\nThe time styles are numerous and can handle localization to any supported locale. The following table provides a listing of all time styles and their output values (corresponding to an input time of 2000-02-29 14:35:00).\n\n\n\n\nTime Style\nOutput\nNotes\n\n\n\n\n1\n\"iso\"\n\"14:35:00\"\nISO 8601, 24h\n\n\n2\n\"iso-short\"\n\"14:35\"\nISO 8601, 24h\n\n\n3\n\"h_m_s_p\"\n\"2:35:00 PM\"\n12h\n\n\n4\n\"h_m_p\"\n\"2:35 PM\"\n12h\n\n\n5\n\"h_p\"\n\"2 PM\"\n12h\n\n\n\nWe can use the info_date_style() and info_time_style() functions within the console to view similar tables of date and time styles with example output.\n\n\nReturns\n\n\n\nType\nDescription\n\n\n\n\nGT\nThe GT object is returned. This is the same object that the method is called on so that we can facilitate method chaining.\n\n\n\n\n\nExamples\nLet’s use the exibble dataset to create a simple, two-column table (keeping only the date and time columns). With the fmt_datetime() method, we’ll format the date column to display dates formatted with the \"month_day_year\" date style and the time column to display times formatted with the \"h_m_s_p\" time style.\n\nfrom great_tables import GT, exibble\n\nexibble_mini = exibble[[\"date\", \"time\"]]\n\n(\n GT(exibble_mini)\n .fmt_datetime(\n columns=\"date\",\n date_style=\"month_day_year\",\n time_style=\"h_m_s_p\"\n )\n)\n\n\n\n\n\n\n\n date\n time\n\n\n\n \n January 15, 2015 12:00:00 AM\n 13:35\n \n \n February 15, 2015 12:00:00 AM\n 14:40\n \n \n March 15, 2015 12:00:00 AM\n 15:45\n \n \n April 15, 2015 12:00:00 AM\n 16:50\n \n \n May 15, 2015 12:00:00 AM\n 17:55\n \n \n June 15, 2015 12:00:00 AM\n \n \n \n \n 19:10\n \n \n August 15, 2015 12:00:00 AM\n 20:20\n \n\n\n\n\n\n\n \n\n\n\n\n\nfmt_image\nGT.fmt_image(self, columns=None, rows=None, height=None, width=None, sep=' ', path=None, file_pattern='{}', encode=True)\nFormat image paths to generate images in cells.\nTo more easily insert graphics into body cells, we can use the fmt_image() method. This allows for one or more images to be placed in the targeted cells. The cells need to contain some reference to an image file, either: (1) complete http/https or local paths to the files; (2) the file names, where a common path can be provided via path=; or (3) a fragment of the file name, where the file_pattern= argument helps to compose the entire file name and path= provides the path information. This should be expressly used on columns that contain only references to image files (i.e., no image references as part of a larger block of text). Multiple images can be included per cell by separating image references by commas. The sep= argument allows for a common separator to be applied between images.\n\nParameters\n\n\n\n\n\n\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\ncolumns\nSelectExpr\nThe columns to target. Can either be a single column name or a series of column names provided in a list.\nNone\n\n\nrows\nint | list[int] | None\nIn conjunction with columns=, we can specify which of their rows should undergo formatting. The default is all rows, resulting in all rows in targeted columns being formatted. Alternatively, we can supply a list of row indices.\nNone\n\n\nheight\nstr | int | None\nThe height of the rendered images.\nNone\n\n\nwidth\nstr | int | None\nThe width of the rendered images.\nNone\n\n\nsep\nstr\nIn the output of images within a body cell, sep= provides the separator between each image.\n' '\n\n\npath\nstr | Path | None\nAn optional path to local image files (this is combined with all filenames).\nNone\n\n\nfile_pattern\nstr\nThe pattern to use for mapping input values in the body cells to the names of the graphics files. The string supplied should use \"{}\" in the pattern to map filename fragments to input strings.\n'{}'\n\n\nencode\nbool\nThe option to always use Base64 encoding for image paths that are determined to be local. By default, this is True.\nTrue\n\n\n\n\n\nReturns\n\n\n\nType\nDescription\n\n\n\n\nGT\nThe GT object is returned. This is the same object that the method is called on so that we can facilitate method chaining.\n\n\n\n\n\nExamples\nUsing a small portion of metro dataset, let’s create a new table. We will only include a few columns and rows from that table. The lines column has comma-separated listings of numbers corresponding to lines served at each station. We have a directory of SVG graphics for all of these lines in the package (the path for the image directory can be accessed via files(\"great_tables\") / \"data/metro_images\", using the importlib_resources package). The filenames roughly corresponds to the data in the lines column. The fmt_image() method can be used with these inputs since the path= and file_pattern= arguments allow us to compose complete and valid file locations. What you get from this are sequences of images in the table cells, taken from the referenced graphics files on disk.\n\nfrom great_tables import GT\nfrom great_tables.data import metro\nfrom importlib_resources import files\n\nimg_paths = files(\"great_tables\") / \"data/metro_images\"\n\nmetro_mini = metro[[\"name\", \"lines\", \"passengers\"]].head(5)\n\n(\n GT(metro_mini)\n .fmt_image(\n columns=\"lines\",\n path=img_paths,\n file_pattern=\"metro_{}.svg\"\n )\n .fmt_integer(columns=\"passengers\")\n)\n\n\n\n\n\n\n\n name\n lines\n passengers\n\n\n\n \n Argentine\n \n 2,079,212\n \n \n Bastille\n \n 8,069,243\n \n \n Bérault\n \n 2,106,827\n \n \n Champs-Élysées—Clemenceau\n \n 1,909,005\n \n \n Charles de Gaulle—Étoile\n \n 4,291,663\n \n\n\n\n\n\n\n \n\n\n\n\n\nfmt_integer\nGT.fmt_integer(self, columns=None, rows=None, use_seps=True, scale_by=1, compact=False, pattern='{x}', sep_mark=',', force_sign=False, locale=None)\nFormat values as integers.\nWith numeric values in one or more table columns, we can perform number-based formatting so that the targeted values are always rendered as integer values.\nWe can have fine control over integer formatting with the following options:\n\ndigit grouping separators: options to enable/disable digit separators and provide a choice of separator symbol\nscaling: we can choose to scale targeted values by a multiplier value\nlarge-number suffixing: larger figures (thousands, millions, etc.) can be autoscaled and decorated with the appropriate suffixes\npattern: option to use a text pattern for decoration of the formatted values\nlocale-based formatting: providing a locale ID will result in number formatting specific to the chosen locale\n\n\nParameters\n\n\n\n\n\n\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\ncolumns\nSelectExpr\nThe columns to target. Can either be a single column name or a series of column names provided in a list.\nNone\n\n\nrows\nint | list[int] | None\nIn conjunction with columns=, we can specify which of their rows should undergo formatting. The default is all rows, resulting in all rows in targeted columns being formatted. Alternatively, we can supply a list of row indices.\nNone\n\n\nuse_seps\nbool\nThe use_seps option allows for the use of digit group separators. The type of digit group separator is set by sep_mark and overridden if a locale ID is provided to locale. This setting is True by default.\nTrue\n\n\nscale_by\nfloat\nAll numeric values will be multiplied by the scale_by value before undergoing formatting. Since the default value is 1, no values will be changed unless a different multiplier value is supplied.\n1\n\n\ncompact\nbool\nA boolean value that allows for compact formatting of numeric values. Values will be scaled and decorated with the appropriate suffixes (e.g., 1230 becomes 1K, and 1230000 becomes 1M). The compact option is False by default.\nFalse\n\n\npattern\nstr\nA formatting pattern that allows for decoration of the formatted value. The formatted value is represented by the {x} (which can be used multiple times, if needed) and all other characters will be interpreted as string literals.\n'{x}'\n\n\nsep_mark\nstr\nThe string to use as a separator between groups of digits. For example, using sep_mark=\",\" with a value of 1000 would result in a formatted value of \"1,000\". This argument is ignored if a locale is supplied (i.e., is not None).\n','\n\n\nforce_sign\nbool\nShould the positive sign be shown for positive values (effectively showing a sign for all values except zero)? If so, use True for this option. The default is False, where only negative numbers will display a minus sign.\nFalse\n\n\nlocale\nstr | None\nAn optional locale identifier that can be used for formatting values according the locale’s rules. Examples include \"en\" for English (United States) and \"fr\" for French (France).\nNone\n\n\n\n\n\nReturns\n\n\n\nType\nDescription\n\n\n\n\nGT\nThe GT object is returned. This is the same object that the method is called on so that we can facilitate method chaining.\n\n\n\n\n\nAdapting Output To A Specific Locale\nThis formatting method can adapt outputs according to a provided locale value. Examples include \"en\" for English (United States) and \"fr\" for French (France). The use of a valid locale ID here means separator marks will be correct for the given locale. Should any value be provided in sep_mark, it will be overridden by the locale’s preferred value.\nNote that a locale value provided here will override any global locale setting performed in GT()’s own locale argument (it is settable there as a value received by all other methods that have a locale argument).\n\n\nExamples\nFor this example, we’ll use the exibble dataset as the input table. With the fmt_integer() method, we’ll format the num column as integer values having no digit separators (with the use_seps=False option).\n\nfrom great_tables import GT, exibble\n\n(\n GT(exibble)\n .fmt_integer(columns=\"num\", use_seps=False)\n)\n\n\n\n\n\n\n\n num\n char\n fctr\n date\n time\n datetime\n currency\n row\n group\n\n\n\n \n 0\n apricot\n one\n 2015-01-15\n 13:35\n 2018-01-01 02:22\n 49.95\n row_1\n grp_a\n \n \n 2\n banana\n two\n 2015-02-15\n 14:40\n 2018-02-02 14:33\n 17.95\n row_2\n grp_a\n \n \n 33\n coconut\n three\n 2015-03-15\n 15:45\n 2018-03-03 03:44\n 1.39\n row_3\n grp_a\n \n \n 444\n durian\n four\n 2015-04-15\n 16:50\n 2018-04-04 15:55\n 65100.0\n row_4\n grp_a\n \n \n 5550\n \n five\n 2015-05-15\n 17:55\n 2018-05-05 04:00\n 1325.81\n row_5\n grp_b\n \n \n \n fig\n six\n 2015-06-15\n \n 2018-06-06 16:11\n 13.255\n row_6\n grp_b\n \n \n 777000\n grapefruit\n seven\n \n 19:10\n 2018-07-07 05:22\n \n row_7\n grp_b\n \n \n 8880000\n honeydew\n eight\n 2015-08-15\n 20:20\n \n 0.44\n row_8\n grp_b\n \n\n\n\n\n\n\n \n\n\n\n\nSee Also\nThe fmt_number() method might be more of what you need if you’d like decimal values in your outputs. Need to do integer-based formatting on a value or list of values? Take a look at the functional version of this method: val_fmt_integer().\n\n\n\nfmt_markdown\nGT.fmt_markdown(self, columns=None, rows=None)\nFormat Markdown text.\nAny Markdown-formatted text in the incoming cells will be transformed during render when using the fmt_markdown() method.\n\nParameters\n\n\n\n\n\n\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\ncolumns\nSelectExpr\nThe columns to target. Can either be a single column name or a series of column names provided in a list.\nNone\n\n\nrows\nint | list[int] | None\nIn conjunction with columns=, we can specify which of their rows should undergo formatting. The default is all rows, resulting in all rows in targeted columns being formatted. Alternatively, we can supply a list of row indices.\nNone\n\n\n\n\n\nReturns\n\n\n\nType\nDescription\n\n\n\n\nGT\nThe GT object is returned. This is the same object that the method is called on so that we can facilitate method chaining.\n\n\n\n\n\nExamples:\nLet’s first create a DataFrame containing some text that is Markdown-formatted and then introduce that to GT(). We’ll then transform the md column with the fmt_markdown() method.\n\nimport pandas as pd\nfrom great_tables import GT\nfrom great_tables.data import towny\n\ntext_1 = \"\"\"\n### This is Markdown.\n\nMarkdown’s syntax is comprised entirely of\npunctuation characters, which punctuation\ncharacters have been carefully chosen so as\nto look like what they mean... assuming\nyou’ve ever used email.\n\"\"\"\n\ntext_2 = \"\"\"\nInfo on Markdown syntax can be found\n[here](https://daringfireball.net/projects/markdown/).\n\"\"\"\n\ndf = pd.DataFrame({\"md\": [text_1, text_2]})\n\n(GT(df).fmt_markdown(\"md\"))\n\n\n\n\n\n\n\n md\n\n\n\n \n This is Markdown.\nMarkdown’s syntax is comprised entirely of\npunctuation characters, which punctuation\ncharacters have been carefully chosen so as\nto look like what they mean... assuming\nyou’ve ever used email.\n \n \n Info on Markdown syntax can be found\nhere.\n \n\n\n\n\n\n\n \n\n\n\n\nSee Also\nThe functional version of this method, val_fmt_markdown(), allows you to format a single string value (or a list of them).\n\n\n\nfmt_nanoplot\nGT.fmt_nanoplot(self, columns=None, rows=None, plot_type='line', plot_height='2em', missing_vals='marker', autoscale=False, reference_line=None, reference_area=None, expand_x=None, expand_y=None, options=None)\nFormat data for nanoplot visualizations.\nThe fmt_nanoplot() method is used to format data for nanoplot visualizations. This method allows for the creation of a variety of different plot types, including line, bar, and scatter plots.\n\n\n\n\n\n\nWarning\n\n\n\nfmt_nanoplot() is still experimental.\n\n\n\nParameters\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\ncolumns\nstr | None\nThe columns to target. Can either be a single column name or a series of column names provided in a list.\nNone\n\n\nrows\nint | list[int] | None\nIn conjunction with columns=, we can specify which of their rows should undergo formatting. The default is all rows, resulting in all rows in targeted columns being formatted. Alternatively, we can supply a list of row indices.\nNone\n\n\nplot_type\nPlotType\nNanoplots can either take the form of a line plot (using \"line\") or a bar plot (with \"bar\"). A line plot, by default, contains layers for a data line, data points, and a data area. With a bar plot, the always visible layer is that of the data bars.\n'line'\n\n\nplot_height\nstr\nThe height of the nanoplots. The default here is a sensible value of \"2em\".\n'2em'\n\n\nmissing_vals\nMissingVals\nIf missing values are encountered within the input data, there are three strategies available for their handling: (1) \"gap\" will show data gaps at the sites of missing data, where data lines will have discontinuities and bar plots will have missing bars; (2) \"marker\" will behave like \"gap\" but show prominent visual marks at the missing data locations; (3) \"zero\" will replace missing values with zero values; and (4) \"remove\" will remove any incoming missing values.\n'marker'\n\n\nautoscale\nbool\nUsing autoscale=True will ensure that the bounds of all nanoplots produced are based on the limits of data combined from all input rows. This will result in a shared scale across all of the nanoplots (for y- and x-axis data), which is useful in those cases where the nanoplot data should be compared across rows.\nFalse\n\n\nreference_line\nstr | int | float | None\nA reference line requires a single input to define the line. It could be a numeric value, applied to all nanoplots generated. Or, the input can be one of the following for generating the line from the underlying data: (1) \"mean\", (2) \"median\", (3) \"min\", (4) \"max\", (5) \"q1\", (6) \"q3\", (7) \"first\", or (8) \"last\".\nNone\n\n\nreference_area\nlist[Any] | None\nA reference area requires a list of two values for defining bottom and top boundaries (in the y direction) for a rectangular area. The types of values supplied are the same as those expected for reference_line=, which is either a numeric value or one of the following keywords for the generation of the value: (1) \"mean\", (2) \"median\", (3) \"min\", (4) \"max\", (5) \"q1\", (6) \"q3\", (7) \"first\", or (8) \"last\". Input can either be a vector or list with two elements.\nNone\n\n\nexpand_x\nlist[int] | list[float] | list[int | float] | None\nShould you need to have plots expand in the x direction, provide one or more values to expand_x=. Any values provided that are outside of the range of x-value data provided to the plot will result in a x-scale expansion.\nNone\n\n\nexpand_y\nlist[int] | list[float] | list[int | float] | None\nSimilar to expand_x=, one can have plots expand in the y direction. To make this happen, provide one or more values to expand_y=. If any of the provided values are outside of the range of y-value data provided, the plot will result in a y-scale expansion.\nNone\n\n\noptions\ndict[str, Any] | None\nBy using the nanoplot_options() helper function here, you can alter the layout and styling of the nanoplots in the new column.\nNone\n\n\n\n\n\nReturns\n\n\n\nType\nDescription\n\n\n\n\nGT\nThe GT object is returned. This is the same object that the method is called on so that we can facilitate method chaining.\n\n\n\n\n\nDetails\nNanoplots try to show individual data with reasonably good visibility. Interactivity is included as a basic feature so one can hover over the data points and vertical guides will display the value ascribed to each data point. Because Great Tables knows all about numeric formatting, values will be compactly formatted so as to not take up valuable real estate.\nWhile basic customization options are present in fmt_nanoplot(), many more opportunities for customizing nanoplots on a more granular level are possible with the aforementioned nanoplot_options() helper function. With that, layers of the nanoplots can be selectively removed and the aesthetics of the remaining plot components can be modified.\n\n\nExamples\nLet’s create a nanoplot from a Polars DataFrame containing multiple numbers per cell. The numbers are represented here as strings, where spaces separate the values, and the same values are present in two columns: lines and bars. We will use the fmt_nanoplot() method twice to create a line plot and a bar plot from the data in their respective columns.\n\nfrom great_tables import GT\nimport polars as pl\n\nrandom_numbers_df = pl.DataFrame(\n {\n \"i\": range(1, 5),\n \"lines\": [\n \"20 23 6 7 37 23 21 4 7 16\",\n \"2.3 6.8 9.2 2.42 3.5 12.1 5.3 3.6 7.2 3.74\",\n \"-12 -5 6 3.7 0 8 -7.4\",\n \"2 0 15 7 8 10 1 24 17 13 6\",\n ],\n }\n).with_columns(bars=pl.col(\"lines\"))\n\n(\n GT(random_numbers_df, rowname_col=\"i\")\n .fmt_nanoplot(columns=\"lines\")\n .fmt_nanoplot(columns=\"bars\", plot_type=\"bar\")\n)\n\n\n\n\n\n\n\n \n lines\n bars\n\n\n\n \n 1\n 3742023673723214716\n 3702023673723214716\n \n \n 2\n 12.12.302.306.809.202.423.5012.15.303.607.203.74\n 12.102.306.809.202.423.5012.15.303.607.203.74\n \n \n 3\n 8.00−12.0−12.0−5.006.003.7008.00−7.40\n 8.00−12.0−12.0−5.006.003.7008.00−7.40\n \n \n 4\n 2402015781012417136\n 2402015781012417136\n \n\n\n\n\n\n\n \n\n\nWe can always represent the input DataFrame in a different way (with list columns) and fmt_nanoplot() will still work. While the input data is the same as in the previous example, we’ll take the opportunity here to add a reference line and a reference area to the line plot and also to the bar plot.\n\nrandom_numbers_df = pl.DataFrame(\n {\n \"i\": range(1, 5),\n \"lines\": [\n { \"val\": [20.0, 23.0, 6.0, 7.0, 37.0, 23.0, 21.0, 4.0, 7.0, 16.0] },\n { \"val\": [2.3, 6.8, 9.2, 2.42, 3.5, 12.1, 5.3, 3.6, 7.2, 3.74] },\n { \"val\": [-12.0, -5.0, 6.0, 3.7, 0.0, 8.0, -7.4] },\n { \"val\": [2.0, 0.0, 15.0, 7.0, 8.0, 10.0, 1.0, 24.0, 17.0, 13.0, 6.0] },\n ],\n }\n).with_columns(bars=pl.col(\"lines\"))\n\n(\n GT(random_numbers_df, rowname_col=\"i\")\n .fmt_nanoplot(\n columns=\"lines\",\n reference_line=\"mean\",\n reference_area=[\"min\", \"q1\"]\n )\n .fmt_nanoplot(\n columns=\"bars\",\n plot_type=\"bar\",\n reference_line=\"max\",\n reference_area=[\"max\", \"median\"])\n)\n\n\n\n\n\n\n\n \n lines\n bars\n\n\n\n \n 1\n 16.43742023673723214716\n 37.03742023673723214716\n \n \n 2\n 5.6212.12.302.306.809.202.423.5012.15.303.607.203.74\n 12.112.12.302.306.809.202.423.5012.15.303.607.203.74\n \n \n 3\n −0.968.00−12.0−12.0−5.006.003.7008.00−7.40\n 8.008.00−12.0−12.0−5.006.003.7008.00−7.40\n \n \n 4\n 9.362402015781012417136\n 24.02402015781012417136\n \n\n\n\n\n\n\n \n\n\nHere’s an example to adjust some of the options using nanoplot_options().\n\nfrom great_tables import nanoplot_options\n\n(\n GT(random_numbers_df, rowname_col=\"i\")\n .fmt_nanoplot(\n columns=\"lines\",\n reference_line=\"mean\",\n reference_area=[\"min\", \"q1\"],\n options=nanoplot_options(\n data_point_radius=8,\n data_point_stroke_color=\"black\",\n data_point_stroke_width=2,\n data_point_fill_color=\"white\",\n data_line_type=\"straight\",\n data_line_stroke_color=\"brown\",\n data_line_stroke_width=2,\n data_area_fill_color=\"orange\",\n vertical_guide_stroke_color=\"green\",\n ),\n )\n .fmt_nanoplot(\n columns=\"bars\",\n plot_type=\"bar\",\n reference_line=\"max\",\n reference_area=[\"max\", \"median\"],\n options=nanoplot_options(\n data_bar_stroke_color=\"gray\",\n data_bar_stroke_width=2,\n data_bar_fill_color=\"orange\",\n data_bar_negative_stroke_color=\"blue\",\n data_bar_negative_stroke_width=1,\n data_bar_negative_fill_color=\"lightblue\",\n reference_line_color=\"pink\",\n reference_area_fill_color=\"bisque\",\n vertical_guide_stroke_color=\"blue\",\n ),\n )\n)\n\n\n\n\n\n\n\n \n lines\n bars\n\n\n\n \n 1\n 16.43742023673723214716\n 37.03742023673723214716\n \n \n 2\n 5.6212.12.302.306.809.202.423.5012.15.303.607.203.74\n 12.112.12.302.306.809.202.423.5012.15.303.607.203.74\n \n \n 3\n −0.968.00−12.0−12.0−5.006.003.7008.00−7.40\n 8.008.00−12.0−12.0−5.006.003.7008.00−7.40\n \n \n 4\n 9.362402015781012417136\n 24.02402015781012417136\n \n\n\n\n\n\n\n \n\n\nSingle-value bar plots and line plots can be made with fmt_nanoplot(). These run in the horizontal direction, which is ideal for tabular presentation. The key thing here is that fmt_nanoplot() expects a column of numeric values. These plots are meant for comparison across rows so the method automatically scales the horizontal bars to facilitate this type of display. The following example shows how fmt_nanoplot() can be used to create single-value bar and line plots.\n\nsingle_vals_df = pl.DataFrame(\n {\n \"i\": range(1, 6),\n \"bars\": [4.1, 1.3, -5.3, 0, 8.2],\n \"lines\": [12.44, 6.34, 5.2, -8.2, 9.23]\n }\n)\n(\n GT(single_vals_df, rowname_col=\"i\")\n .fmt_nanoplot(columns=\"bars\", plot_type=\"bar\")\n .fmt_nanoplot(columns=\"lines\", plot_type=\"line\")\n)\n\n\n\n\n\n\n\n \n bars\n lines\n\n\n\n \n 1\n 4.10\n 12.4\n \n \n 2\n 1.30\n 6.34\n \n \n 3\n −5.30\n 5.20\n \n \n 4\n 0\n −8.20\n \n \n 5\n 8.20\n 9.23\n \n\n\n\n\n\n\n \n\n\n\n\n\nfmt_number\nGT.fmt_number(self, columns=None, rows=None, decimals=2, n_sigfig=None, drop_trailing_zeros=False, drop_trailing_dec_mark=True, use_seps=True, scale_by=1, compact=False, pattern='{x}', sep_mark=',', dec_mark='.', force_sign=False, locale=None)\nFormat numeric values.\nWith numeric values within a table’s body cells, we can perform number-based formatting so that the targeted values are rendered with a higher consideration for tabular presentation. Furthermore, there is finer control over numeric formatting with the following options:\n\ndecimals: choice of the number of decimal places, option to drop trailing zeros, and a choice of the decimal symbol\ndigit grouping separators: options to enable/disable digit separators and provide a choice of separator symbol\nscaling: we can choose to scale targeted values by a multiplier value\nlarge-number suffixing: larger figures (thousands, millions, etc.) can be autoscaled and decorated with the appropriate suffixes\npattern: option to use a text pattern for decoration of the formatted values\nlocale-based formatting: providing a locale ID will result in number formatting specific to the chosen locale\n\n\nParameters\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\ncolumns\nSelectExpr\nThe columns to target. Can either be a single column name or a series of column names provided in a list.\nNone\n\n\nrows\nint | list[int] | None\nIn conjunction with columns=, we can specify which of their rows should undergo formatting. The default is all rows, resulting in all rows in targeted columns being formatted. Alternatively, we can supply a list of row indices.\nNone\n\n\ndecimals\nint\nThe decimals values corresponds to the exact number of decimal places to use. A value such as 2.34 can, for example, be formatted with 0 decimal places and it would result in \"2\". With 4 decimal places, the formatted value becomes \"2.3400\". The trailing zeros can be removed with drop_trailing_zeros=True. If you always need decimals = 0, the fmt_integer() method should be considered.\n2\n\n\nn_sigfig\nint | None\nA option to format numbers to n significant figures. By default, this is None and thus number values will be formatted according to the number of decimal places set via decimals. If opting to format according to the rules of significant figures, n_sigfig must be a number greater than or equal to 1. Any values passed to the decimals and drop_trailing_zeros arguments will be ignored.\nNone\n\n\ndrop_trailing_zeros\nbool\nA boolean value that allows for removal of trailing zeros (those redundant zeros after the decimal mark).\nFalse\n\n\ndrop_trailing_dec_mark\nbool\nA boolean value that determines whether decimal marks should always appear even if there are no decimal digits to display after formatting (e.g., 23 becomes 23. if False). By default trailing decimal marks are not shown.\nTrue\n\n\nuse_seps\nbool\nThe use_seps option allows for the use of digit group separators. The type of digit group separator is set by sep_mark and overridden if a locale ID is provided to locale. This setting is True by default.\nTrue\n\n\nscale_by\nfloat\nAll numeric values will be multiplied by the scale_by value before undergoing formatting. Since the default value is 1, no values will be changed unless a different multiplier value is supplied.\n1\n\n\ncompact\nbool\nA boolean value that allows for compact formatting of numeric values. Values will be scaled and decorated with the appropriate suffixes (e.g., 1230 becomes 1.23K, and 1230000 becomes 1.23M). The compact option is False by default.\nFalse\n\n\npattern\nstr\nA formatting pattern that allows for decoration of the formatted value. The formatted value is represented by the {x} (which can be used multiple times, if needed) and all other characters will be interpreted as string literals.\n'{x}'\n\n\nsep_mark\nstr\nThe string to use as a separator between groups of digits. For example, using sep_mark=\",\" with a value of 1000 would result in a formatted value of \"1,000\". This argument is ignored if a locale is supplied (i.e., is not None).\n','\n\n\ndec_mark\nstr\nThe string to be used as the decimal mark. For example, using dec_mark=\",\" with the value 0.152 would result in a formatted value of \"0,152\"). This argument is ignored if a locale is supplied (i.e., is not None).\n'.'\n\n\nforce_sign\nbool\nShould the positive sign be shown for positive values (effectively showing a sign for all values except zero)? If so, use True for this option. The default is False, where only negative numbers will display a minus sign.\nFalse\n\n\nlocale\nstr | None\nAn optional locale identifier that can be used for formatting values according the locale’s rules. Examples include \"en\" for English (United States) and \"fr\" for French (France).\nNone\n\n\n\n\n\nReturns\n\n\n\nType\nDescription\n\n\n\n\nGT\nThe GT object is returned. This is the same object that the method is called on so that we can facilitate method chaining.\n\n\n\n\n\nAdapting Output To A Specific Locale\nThis formatting method can adapt outputs according to a provided locale value. Examples include \"en\" for English (United States) and \"fr\" for French (France). The use of a valid locale ID here means separator and decimal marks will be correct for the given locale. Should any values be provided in sep_mark or dec_mark, they will be overridden by the locale’s preferred values.\nNote that a locale value provided here will override any global locale setting performed in GT()’s own locale argument (it is settable there as a value received by all other methods that have a locale argument).\n\n\nExamples\nLet’s use the exibble dataset to create a table. With the fmt_number() method, we’ll format the num column to have three decimal places (with decimals=3) and omit the use of digit separators (with use_seps=False).\n\nfrom great_tables import GT, exibble\n\n(\n GT(exibble)\n .fmt_number(columns=\"num\", decimals=3, use_seps=False)\n)\n\n\n\n\n\n\n\n num\n char\n fctr\n date\n time\n datetime\n currency\n row\n group\n\n\n\n \n 0.111\n apricot\n one\n 2015-01-15\n 13:35\n 2018-01-01 02:22\n 49.95\n row_1\n grp_a\n \n \n 2.222\n banana\n two\n 2015-02-15\n 14:40\n 2018-02-02 14:33\n 17.95\n row_2\n grp_a\n \n \n 33.330\n coconut\n three\n 2015-03-15\n 15:45\n 2018-03-03 03:44\n 1.39\n row_3\n grp_a\n \n \n 444.400\n durian\n four\n 2015-04-15\n 16:50\n 2018-04-04 15:55\n 65100.0\n row_4\n grp_a\n \n \n 5550.000\n \n five\n 2015-05-15\n 17:55\n 2018-05-05 04:00\n 1325.81\n row_5\n grp_b\n \n \n \n fig\n six\n 2015-06-15\n \n 2018-06-06 16:11\n 13.255\n row_6\n grp_b\n \n \n 777000.000\n grapefruit\n seven\n \n 19:10\n 2018-07-07 05:22\n \n row_7\n grp_b\n \n \n 8880000.000\n honeydew\n eight\n 2015-08-15\n 20:20\n \n 0.44\n row_8\n grp_b\n \n\n\n\n\n\n\n \n\n\n\n\nSee Also\nThe fmt_integer() method might be more useful if you really need to format numeric values to appear as integers (i.e., no decimals will be shown and input values are rounded as necessary). Need to do numeric formatting on a value or list of values? Take a look at the functional version of this method: val_fmt_number().\n\n\n\nfmt_percent\nGT.fmt_percent(self, columns=None, rows=None, decimals=2, drop_trailing_zeros=False, drop_trailing_dec_mark=True, scale_values=True, use_seps=True, pattern='{x}', sep_mark=',', dec_mark='.', force_sign=False, placement='right', incl_space=False, locale=None)\nFormat values as a percentage.\nWith numeric values in a gt table, we can perform percentage-based formatting. It is assumed the input numeric values are proportional values and, in this case, the values will be automatically multiplied by 100 before decorating with a percent sign (the other case is accommodated though setting scale_values to False). For more control over percentage formatting, we can use the following options:\n\npercent sign placement: the percent sign can be placed after or before the values and a space can be inserted between the symbol and the value.\ndecimals: choice of the number of decimal places, option to drop trailing zeros, and a choice of the decimal symbol\ndigit grouping separators: options to enable/disable digit separators and provide a choice of separator symbol\nvalue scaling toggle: choose to disable automatic value scaling in the situation that values are already scaled coming in (and just require the percent symbol)\npattern: option to use a text pattern for decoration of the formatted values\nlocale-based formatting: providing a locale ID will result in number formatting specific to the chosen locale\n\n\nParameters\n\n\n\n\n\n\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\ncolumns\nSelectExpr\nThe columns to target. Can either be a single column name or a series of column names provided in a list.\nNone\n\n\nrows\nint | list[int] | None\nIn conjunction with columns=, we can specify which of their rows should undergo formatting. The default is all rows, resulting in all rows in targeted columns being formatted. Alternatively, we can supply a list of row indices.\nNone\n\n\ndecimals\nint\nThe decimals values corresponds to the exact number of decimal places to use. A value such as 2.34 can, for example, be formatted with 0 decimal places and it would result in \"2\". With 4 decimal places, the formatted value becomes \"2.3400\". The trailing zeros can be removed with drop_trailing_zeros=True.\n2\n\n\ndrop_trailing_zeros\nbool\nA boolean value that allows for removal of trailing zeros (those redundant zeros after the decimal mark).\nFalse\n\n\ndrop_trailing_dec_mark\nbool\nA boolean value that determines whether decimal marks should always appear even if there are no decimal digits to display after formatting (e.g., 23 becomes 23. if False). By default trailing decimal marks are not shown.\nTrue\n\n\nscale_values\nbool\nShould the values be scaled through multiplication by 100? By default this scaling is performed since the expectation is that incoming values are usually proportional. Setting to False signifies that the values are already scaled and require only the percent sign when formatted.\nTrue\n\n\nuse_seps\nbool\nThe use_seps option allows for the use of digit group separators. The type of digit group separator is set by sep_mark and overridden if a locale ID is provided to locale. This setting is True by default.\nTrue\n\n\npattern\nstr\nA formatting pattern that allows for decoration of the formatted value. The formatted value is represented by the {x} (which can be used multiple times, if needed) and all other characters will be interpreted as string literals.\n'{x}'\n\n\nsep_mark\nstr\nThe string to use as a separator between groups of digits. For example, using sep_mark=\",\" with a value of 1000 would result in a formatted value of \"1,000\". This argument is ignored if a locale is supplied (i.e., is not None).\n','\n\n\ndec_mark\nstr\nThe string to be used as the decimal mark. For example, using dec_mark=\",\" with the value 0.152 would result in a formatted value of \"0,152\"). This argument is ignored if a locale is supplied (i.e., is not None).\n'.'\n\n\nforce_sign\nbool\nShould the positive sign be shown for positive values (effectively showing a sign for all values except zero)? If so, use True for this option. The default is False, where only negative numbers will display a minus sign.\nFalse\n\n\nplacement\nstr\nThis option governs the placement of the percent sign. This can be either be \"right\" (the default) or \"left\".\n'right'\n\n\nincl_space\nbool\nAn option for whether to include a space between the value and the percent sign. The default is to not introduce a space character.\nFalse\n\n\nlocale\nstr | None\nAn optional locale identifier that can be used for formatting values according the locale’s rules. Examples include \"en\" for English (United States) and \"fr\" for French (France).\nNone\n\n\n\n\n\nReturns\n\n\n\nType\nDescription\n\n\n\n\nGT\nThe GT object is returned. This is the same object that the method is called on so that we can facilitate method chaining.\n\n\n\n\n\nAdapting Output To A Specific Locale\nThis formatting method can adapt outputs according to a provided locale value. Examples include \"en\" for English (United States) and \"fr\" for French (France). The use of a valid locale ID here means separator and decimal marks will be correct for the given locale. Should any values be provided in sep_mark or dec_mark, they will be overridden by the locale’s preferred values.\nNote that a locale value provided here will override any global locale setting performed in GT()’s own locale argument (it is settable there as a value received by all other methods that have a locale argument).\n\n\nExamples\nLet’s use the towny dataset as the input table. With the fmt_percent() method, we’ll format the pop_change_2016_2021_pct column to to display values as percentages (to two decimal places).\n\nfrom great_tables import GT\nfrom great_tables.data import towny\n\ntowny_mini = (\n towny[[\"name\", \"pop_change_2016_2021_pct\"]]\n .head(10)\n)\n\n(GT(towny_mini).fmt_percent(\"pop_change_2016_2021_pct\", decimals=2))\n\n\n\n\n\n\n\n name\n pop_change_2016_2021_pct\n\n\n\n \n Addington Highlands\n 9.32%\n \n \n Adelaide Metcalfe\n 0.70%\n \n \n Adjala-Tosorontio\n 0.13%\n \n \n Admaston/Bromley\n 2.04%\n \n \n Ajax\n 5.84%\n \n \n Alberton\n −1.55%\n \n \n Alfred and Plantagenet\n 2.78%\n \n \n Algonquin Highlands\n 10.08%\n \n \n Alnwick/Haldimand\n 8.79%\n \n \n Amaranth\n 6.08%\n \n\n\n\n\n\n\n \n\n\n\n\nSee Also\nThe functional version of this method, val_fmt_percent(), allows you to format a single numerical value (or a list of them).\n\n\n\nfmt_roman\nGT.fmt_roman(self, columns=None, rows=None, case='upper', pattern='{x}')\nFormat values as Roman numerals.\nWith numeric values in a gt table we can transform those to Roman numerals, rounding values as necessary.\n\nParameters\n\n\n\n\n\n\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\ncolumns\nSelectExpr\nThe columns to target. Can either be a single column name or a series of column names provided in a list.\nNone\n\n\nrows\nint | list[int] | None\nIn conjunction with columns=, we can specify which of their rows should undergo formatting. The default is all rows, resulting in all rows in targeted columns being formatted. Alternatively, we can supply a list of row indices.\nNone\n\n\ncase\nstr\nShould Roman numerals should be rendered as uppercase (\"upper\") or lowercase (\"lower\") letters? By default, this is set to \"upper\".\n'upper'\n\n\npattern\nstr\nA formatting pattern that allows for decoration of the formatted value. The formatted value is represented by the {x} (which can be used multiple times, if needed) and all other characters will be interpreted as string literals.\n'{x}'\n\n\n\n\n\nReturns\n\n\n\nType\nDescription\n\n\n\n\nGT\nThe GT object is returned. This is the same object that the method is called on so that we can facilitate method chaining.\n\n\n\n\n\nExamples\nLet’s first create a DataFrame containing small numeric values and then introduce that to GT(). We’ll then format the roman column to appear as Roman numerals with the fmt_roman() method.\n\nimport pandas as pd\nfrom great_tables import GT\n\nnumbers_tbl = pd.DataFrame({\"arabic\": [1, 8, 24, 85], \"roman\": [1, 8, 24, 85]})\n\n(\n GT(numbers_tbl, rowname_col=\"arabic\")\n .fmt_roman(columns=\"roman\")\n)\n\n\n\n\n\n\n\n \n roman\n\n\n\n \n 1\n I\n \n \n 8\n VIII\n \n \n 24\n XXIV\n \n \n 85\n LXXXV\n \n\n\n\n\n\n\n \n\n\n\n\nSee Also\nThe functional version of this method, val_fmt_roman(), allows you to format a single numerical value (or a list of them).\n\n\n\nfmt_scientific\nGT.fmt_scientific(self, columns=None, rows=None, decimals=2, n_sigfig=None, drop_trailing_zeros=False, drop_trailing_dec_mark=True, scale_by=1, exp_style='x10n', pattern='{x}', sep_mark=',', dec_mark='.', force_sign_m=False, force_sign_n=False, locale=None)\nFormat values to scientific notation.\nWith numeric values in a table, we can perform formatting so that the targeted values are rendered in scientific notation, where extremely large or very small numbers can be expressed in a more practical fashion. Here, numbers are written in the form of a mantissa (m) and an exponent (n) with the construction m x 10^n or mEn. The mantissa component is a number between 1 and 10. For instance, 2.5 x 10^9 can be used to represent the value 2,500,000,000 in scientific notation. In a similar way, 0.00000012 can be expressed as 1.2 x 10^-7. Due to its ability to describe numbers more succinctly and its ease of calculation, scientific notation is widely employed in scientific and technical domains.\nWe have fine control over the formatting task, with the following options:\n\ndecimals: choice of the number of decimal places, option to drop trailing zeros, and a choice of the decimal symbol\nscaling: we can choose to scale targeted values by a multiplier value\npattern: option to use a text pattern for decoration of the formatted values\nlocale-based formatting: providing a locale ID will result in formatting specific to the chosen locale\n\n\nParameters\n\n\n\n\n\n\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\ncolumns\nSelectExpr\nThe columns to target. Can either be a single column name or a series of column names provided in a list.\nNone\n\n\nrows\nint | list[int] | None\nIn conjunction with columns=, we can specify which of their rows should undergo formatting. The default is all rows, resulting in all rows in targeted columns being formatted. Alternatively, we can supply a list of row indices.\nNone\n\n\ndecimals\nint\nThe decimals values corresponds to the exact number of decimal places to use. A value such as 2.34 can, for example, be formatted with 0 decimal places and it would result in \"2\". With 4 decimal places, the formatted value becomes \"2.3400\". The trailing zeros can be removed with drop_trailing_zeros=True.\n2\n\n\nn_sigfig\nint | None\nA option to format numbers to n significant figures. By default, this is None and thus number values will be formatted according to the number of decimal places set via decimals. If opting to format according to the rules of significant figures, n_sigfig must be a number greater than or equal to 1. Any values passed to the decimals and drop_trailing_zeros arguments will be ignored.\nNone\n\n\ndrop_trailing_zeros\nbool\nA boolean value that allows for removal of trailing zeros (those redundant zeros after the decimal mark).\nFalse\n\n\ndrop_trailing_dec_mark\nbool\nA boolean value that determines whether decimal marks should always appear even if there are no decimal digits to display after formatting (e.g., 23 becomes 23. if False). By default trailing decimal marks are not shown.\nTrue\n\n\nscale_by\nfloat\nAll numeric values will be multiplied by the scale_by value before undergoing formatting. Since the default value is 1, no values will be changed unless a different multiplier value is supplied.\n1\n\n\nexp_style\nstr\nStyle of formatting to use for the scientific notation formatting. By default this is \"x10n\" but other options include using a single letter (e.g., \"e\", \"E\", etc.), a letter followed by a \"1\" to signal a minimum digit width of one, or \"low-ten\" for using a stylized \"10\" marker.\n'x10n'\n\n\npattern\nstr\nA formatting pattern that allows for decoration of the formatted value. The formatted value is represented by the {x} (which can be used multiple times, if needed) and all other characters will be interpreted as string literals.\n'{x}'\n\n\nsep_mark\nstr\nThe string to use as a separator between groups of digits. For example, using sep_mark=\",\" with a value of 1000 would result in a formatted value of \"1,000\". This argument is ignored if a locale is supplied (i.e., is not None).\n','\n\n\ndec_mark\nstr\nThe string to be used as the decimal mark. For example, using dec_mark=\",\" with the value 0.152 would result in a formatted value of \"0,152\"). This argument is ignored if a locale is supplied (i.e., is not None).\n'.'\n\n\nforce_sign_m\nbool\nShould the plus sign be shown for positive values of the mantissa (first component)? This would effectively show a sign for all values except zero on the first numeric component of the notation. If so, use True (the default for this is False), where only negative numbers will display a sign.\nFalse\n\n\nforce_sign_n\nbool\nShould the plus sign be shown for positive values of the exponent (second component)? This would effectively show a sign for all values except zero on the second numeric component of the notation. If so, use True (the default for this is False), where only negative numbers will display a sign.\nFalse\n\n\nlocale\nstr | None\nAn optional locale identifier that can be used for formatting values according the locale’s rules. Examples include \"en\" for English (United States) and \"fr\" for French (France).\nNone\n\n\n\n\n\nReturns\n\n\n\nType\nDescription\n\n\n\n\nGT\nThe GT object is returned. This is the same object that the method is called on so that we can facilitate method chaining.\n\n\n\n\n\nAdapting Output To A Specific Locale\nThis formatting method can adapt outputs according to a provided locale value. Examples include \"en\" for English (United States) and \"fr\" for French (France). The use of a valid locale ID here means separator and decimal marks will be correct for the given locale. Should any values be provided in sep_mark or dec_mark, they will be overridden by the locale’s preferred values.\nNote that a locale value provided here will override any global locale setting performed in GT()’s own locale argument (it is settable there as a value received by all other methods that have a locale argument).\n\n\nExamples\nFor this example, we’ll use the exibble dataset as the input table. With the fmt_scientific() method, we’ll format the num column to contain values in scientific formatting.\n\nfrom great_tables import GT, exibble\n\n(\n GT(exibble)\n .fmt_scientific(columns=\"num\")\n)\n\n\n\n\n\n\n\n num\n char\n fctr\n date\n time\n datetime\n currency\n row\n group\n\n\n\n \n 1.11 × 10−1\n apricot\n one\n 2015-01-15\n 13:35\n 2018-01-01 02:22\n 49.95\n row_1\n grp_a\n \n \n 2.22\n banana\n two\n 2015-02-15\n 14:40\n 2018-02-02 14:33\n 17.95\n row_2\n grp_a\n \n \n 3.33 × 101\n coconut\n three\n 2015-03-15\n 15:45\n 2018-03-03 03:44\n 1.39\n row_3\n grp_a\n \n \n 4.44 × 102\n durian\n four\n 2015-04-15\n 16:50\n 2018-04-04 15:55\n 65100.0\n row_4\n grp_a\n \n \n 5.55 × 103\n \n five\n 2015-05-15\n 17:55\n 2018-05-05 04:00\n 1325.81\n row_5\n grp_b\n \n \n \n fig\n six\n 2015-06-15\n \n 2018-06-06 16:11\n 13.255\n row_6\n grp_b\n \n \n 7.77 × 105\n grapefruit\n seven\n \n 19:10\n 2018-07-07 05:22\n \n row_7\n grp_b\n \n \n 8.88 × 106\n honeydew\n eight\n 2015-08-15\n 20:20\n \n 0.44\n row_8\n grp_b\n \n\n\n\n\n\n\n \n\n\n\n\nSee Also\nThe functional version of this method, val_fmt_scientific(), allows you to format a single numerical value (or a list of them).\n\n\n\nfmt_time\nGT.fmt_time(self, columns=None, rows=None, time_style='iso', pattern='{x}', locale=None)\nFormat values as times.\nFormat input values to time values using one of 5 preset time styles. Input can be in the form of time values, or strings in the ISO 8601 forms of HH:MM:SS or YYYY-MM-DD HH:MM:SS.\n\nParameters\n\n\n\n\n\n\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\ncolumns\nSelectExpr\nThe columns to target. Can either be a single column name or a series of column names provided in a list.\nNone\n\n\nrows\nint | list[int] | None\nIn conjunction with columns=, we can specify which of their rows should undergo formatting. The default is all rows, resulting in all rows in targeted columns being formatted. Alternatively, we can supply a list of row indices.\nNone\n\n\ntime_style\nTimeStyle\nThe time style to use. By default this is the short name \"iso\" which corresponds to how times are formatted within ISO 8601 datetime values. There are 5 time styles in total and their short names can be viewed using info_time_style().\n'iso'\n\n\npattern\nstr\nA formatting pattern that allows for decoration of the formatted value. The formatted value is represented by the {x} (which can be used multiple times, if needed) and all other characters will be interpreted as string literals.\n'{x}'\n\n\nlocale\nstr | None\nAn optional locale identifier that can be used for formatting values according the locale’s rules. Examples include \"en\" for English (United States) and \"fr\" for French (France).\nNone\n\n\n\n\n\nFormatting With The Time_Style Argument\nWe need to supply a preset time style to the time_style argument. The time styles are numerous and can handle localization to any supported locale. The following table provides a listing of all time styles and their output values (corresponding to an input time of 14:35:00).\n\n\n\n\nTime Style\nOutput\nNotes\n\n\n\n\n1\n\"iso\"\n\"14:35:00\"\nISO 8601, 24h\n\n\n2\n\"iso-short\"\n\"14:35\"\nISO 8601, 24h\n\n\n3\n\"h_m_s_p\"\n\"2:35:00 PM\"\n12h\n\n\n4\n\"h_m_p\"\n\"2:35 PM\"\n12h\n\n\n5\n\"h_p\"\n\"2 PM\"\n12h\n\n\n\nWe can use the info_time_style() function within the console to view a similar table of time styles with example output.\n\n\nReturns\n\n\n\nType\nDescription\n\n\n\n\nGT\nThe GT object is returned. This is the same object that the method is called on so that we can facilitate method chaining.\n\n\n\n\n\nAdapting Output To A Specific Locale\nThis formatting method can adapt outputs according to a provided locale value. Examples include \"en\" for English (United States) and \"fr\" for French (France). Note that a locale value provided here will override any global locale setting performed in GT()’s own locale argument (it is settable there as a value received by all other methods that have a locale argument).\n\n\nExamples\nLet’s use the exibble dataset to create a simple, two-column table (keeping only the date and time columns). With the fmt_time() method, we’ll format the time column to display times formatted with the \"h_m_s_p\" time style.\n\nfrom great_tables import GT, exibble\n\nexibble_mini = exibble[[\"date\", \"time\"]]\n\n(\n GT(exibble_mini)\n .fmt_time(columns=\"time\", time_style=\"h_m_s_p\")\n)\n\n\n\n\n\n\n\n date\n time\n\n\n\n \n 2015-01-15\n 1:35:00 PM\n \n \n 2015-02-15\n 2:40:00 PM\n \n \n 2015-03-15\n 3:45:00 PM\n \n \n 2015-04-15\n 4:50:00 PM\n \n \n 2015-05-15\n 5:55:00 PM\n \n \n 2015-06-15\n \n \n \n \n 7:10:00 PM\n \n \n 2015-08-15\n 8:20:00 PM\n \n\n\n\n\n\n\n \n\n\n\n\nSee Also\nThe functional version of this method, val_fmt_time(), allows you to format a single numerical value (or a list of them).\n\n\n\nfmt_units\nGT.fmt_units(self, columns=None, rows=None, pattern='{x}')\nFormat measurement units.\nThe fmt_units() method lets you better format measurement units in the table body. These must conform to the Great Tables units notation; as an example of this, \"J Hz^-1 mol^-1\" can be used to generate units for the molar Planck constant. The notation here provides several conveniences for defining units, so as long as the values to be formatted conform to this syntax, you’ll obtain nicely-formatted inline units. Details pertaining to units notation can be found in the section entitled How to use units notation.\n\nParameters\n\n\n\n\n\n\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\ncolumns\nSelectExpr\nThe columns to target. Can either be a single column name or a series of column names provided in a list.\nNone\n\n\nrows\nint | list[int] | None\nIn conjunction with columns=, we can specify which of their rows should undergo formatting. The default is all rows, resulting in all rows in targeted columns being formatted. Alternatively, we can supply a list of row indices.\nNone\n\n\npattern\nstr\nA formatting pattern that allows for decoration of the formatted value. The formatted value is represented by the {x} (which can be used multiple times, if needed) and all other characters will be interpreted as string literals.\n'{x}'\n\n\n\n\n\nHow To Use Units Notation\nThe Great Tables units notation involves a shorthand of writing units that feels familiar and is fine-tuned for the task at hand. Each unit is treated as a separate entity (parentheses and other symbols included) and the addition of subscript text and exponents is flexible and relatively easy to formulate. This is all best shown with examples:\n\n\"m/s\" and \"m / s\" both render as \"m/s\"\n\"m s^-1\" will appear with the \"-1\" exponent intact\n\"m /s\" gives the the same result, as \"/<unit>\" is equivalent to \"<unit>^-1\"\n\"E_h\" will render an \"E\" with the \"h\" subscript\n\"t_i^2.5\" provides a t with an \"i\" subscript and a \"2.5\" exponent\n\"m[_0^2]\" will use overstriking to set both scripts vertically\n\"g/L %C6H12O6%\" uses a chemical formula (enclosed in a pair of \"%\" characters) as a unit partial, and the formula will render correctly with subscripted numbers\nCommon units that are difficult to write using ASCII text may be implicitly converted to the correct characters (e.g., the \"u\" in \"ug\", \"um\", \"uL\", and \"umol\" will be converted to the Greek mu symbol; \"degC\" and \"degF\" will render a degree sign before the temperature unit)\nWe can transform shorthand symbol/unit names enclosed in \":\" (e.g., \":angstrom:\", \":ohm:\", etc.) into proper symbols\nGreek letters can added by enclosing the letter name in \":\"; you can use lowercase letters (e.g., \":beta:\", \":sigma:\", etc.) and uppercase letters too (e.g., \":Alpha:\", \":Zeta:\", etc.)\nThe components of a unit (unit name, subscript, and exponent) can be fully or partially italicized/emboldened by surrounding text with \"*\" or \"**\"\n\n\n\nReturns\n\n\n\nType\nDescription\n\n\n\n\nGT\nThe GT object is returned. This is the same object that the method is called on so that we can facilitate method chaining.\n\n\n\n\n\nExamples\nLet’s use the illness dataset and create a new table. The units column happens to contain string values in units notation (e.g., \"x10^9 / L\"). Using the fmt_units() method here will improve the formatting of those measurement units.\n\nfrom great_tables import GT, style, loc\nfrom great_tables.data import illness\n\n(\n GT(illness, rowname_col=\"test\")\n .fmt_units(columns=\"units\")\n .fmt_number(columns=lambda x: x.startswith(\"day\"), decimals=2, drop_trailing_zeros=True)\n .tab_header(title=\"Laboratory Findings for the YF Patient\")\n .tab_spanner(label=\"Day\", columns=lambda x: x.startswith(\"day\"))\n .tab_spanner(label=\"Normal Range\", columns=lambda x: x.startswith(\"norm\"))\n .cols_label(\n norm_l=\"Lower\",\n norm_u=\"Upper\",\n units=\"Units\"\n )\n .opt_vertical_padding(scale=0.4)\n .opt_align_table_header(align=\"left\")\n .tab_options(heading_padding=\"10px\")\n .tab_style(\n locations=loc.body(columns=\"norm_l\"),\n style=style.borders(sides=\"left\")\n )\n .opt_vertical_padding(scale=0.5)\n)\n\n\n\n\n\n\n \n Laboratory Findings for the YF Patient\n \n\n \n Units\n \n Day\n \n \n Normal Range\n \n\n\n day_3\n day_4\n day_5\n day_6\n day_7\n day_8\n day_9\n Lower\n Upper\n\n\n\n \n Viral load\n copies per mL\n 12,000\n 4,200\n 1,600\n 830\n 760\n 520\n 250\n \n \n \n \n WBC\n ×109/L\n 5.26\n 4.26\n 9.92\n 10.49\n 24.77\n 30.26\n 19.03\n 4.0\n 10.0\n \n \n Neutrophils\n ×109/L\n 4.87\n 4.72\n 7.92\n 18.21\n 22.08\n 27.17\n 16.59\n 2.0\n 8.0\n \n \n RBC\n ×1012/L\n 5.72\n 5.98\n 4.23\n 4.83\n 4.12\n 2.68\n 3.32\n 4.0\n 5.5\n \n \n Hb\n g/L\n 153\n 135\n 126\n 115\n 75\n 87\n 95\n 120.0\n 160.0\n \n \n PLT\n ×109/L\n 67\n 38.6\n 27.4\n 26.2\n 74.1\n 36.2\n 25.6\n 100.0\n 300.0\n \n \n ALT\n U/L\n 12,835\n 12,632\n 6,426.7\n 4,263.1\n 1,623.7\n 672.6\n 512.4\n 9.0\n 50.0\n \n \n AST\n U/L\n 23,672\n 21,368\n 14,730\n 8,691\n 2,189\n 1,145\n 782.5\n 15.0\n 40.0\n \n \n TBIL\n µmol/L\n 117.2\n 143.8\n 137.2\n 158.1\n 127.3\n 105.1\n 163.2\n 0.0\n 18.8\n \n \n DBIL\n µmol/L\n 71.4\n 104.6\n 94.6\n 143.9\n 117.8\n 83.6\n 126.3\n 0.0\n 6.8\n \n \n NH3\n mmol/L\n 115.2\n 135.2\n 131\n 176.7\n 84.2\n 72.4\n 91.9\n 10.0\n 47.0\n \n \n PT\n s\n 24.6\n 42.4\n 53.7\n 54\n 22.6\n 16.8\n 29.5\n 9.4\n 12.5\n \n \n APTT\n s\n 39.2\n 57.2\n 65.9\n 68.3\n 62.4\n 61.7\n 114.7\n 25.1\n 36.5\n \n \n PTA\n %\n 41\n 25\n 19\n 14\n 51\n 55\n 31\n 70.0\n 130.0\n \n \n DD\n mg/L\n 32.9\n 35.1\n 24.5\n 25.6\n 18.7\n 24.7\n 64.8\n 0.0\n 5.0\n \n \n FDP\n µg/mL\n 84.7\n 92.5\n 77.2\n \n \n 157.2\n 291.7\n 0.0\n 5.0\n \n \n Fibrinogen\n mg/dL\n 238.1\n 216.8\n 135\n 85.2\n 105.7\n \n 64.3\n 200.0\n 400.0\n \n \n LDH\n U/L\n 5,727.3\n 2,622.8\n 2,418.7\n 546.3\n \n 637.2\n \n 80.0\n 285.0\n \n \n HBDH\n \n 5,971.2\n 5,826.9\n 4,826.9\n 2,871.2\n \n 1,163.6\n \n 74.0\n 182.0\n \n \n CK\n U/L\n 725\n 792.1\n 760.2\n 1,263.6\n \n 1,294.2\n \n 38.0\n 174.0\n \n \n CKMB\n U/L\n 75\n 71\n 58\n 65\n \n 68\n \n \n 25.0\n \n \n BNP\n pg/mL\n 37\n \n 73\n \n 482\n 421\n 1,332\n \n 100.0\n \n \n MYO\n ng/mL\n 636.6\n 762.1\n 364.6\n 9,999\n 9,999\n 9,999\n 9,999\n 0.0\n 140.0\n \n \n TnI\n ng/mL\n 0.03\n 0.04\n 0.05\n 0.16\n 0.14\n 2.84\n 8.94\n 0.0\n 0.028\n \n \n CREA\n µmol/L\n 705.6\n 683.6\n 523.6\n 374\n 259.6\n 241.8\n 211.4\n 59.0\n 104.0\n \n \n BUN\n mmol/L\n 20.13\n 25.33\n 13.33\n 7.84\n 4.23\n 3.92\n 3.41\n 1.7\n 8.3\n \n \n AMY\n U/L\n \n 232.8\n 394.6\n 513.7\n \n 642.9\n 538.9\n 0.0\n 115.0\n \n \n LPS\n U/L\n \n 227.6\n 526.9\n 487.9\n \n 437.8\n 414.5\n 5.6\n 51.3\n \n \n K\n mmol/L\n 4.19\n 4.64\n 4.34\n 4.83\n 4.53\n 4.37\n 5.74\n 3.5\n 5.3\n \n \n Na\n mmol/L\n 136.3\n 135.7\n 142.1\n 140.8\n 144.8\n 143.6\n 144.2\n 137.0\n 147.0\n \n \n Cl\n mmol/L\n 91.2\n 92.9\n 96.6\n 99.2\n 102.1\n 99.5\n 105.2\n 99.0\n 110.0\n \n \n Ca\n mmol/L\n 1.74\n 1.64\n 2.25\n 2.35\n 2.16\n 2.03\n 2.29\n 2.2\n 2.55\n \n \n P\n mmol/L\n 2.96\n 3.23\n 1.47\n 1.15\n 0.97\n 1.57\n 1.63\n 0.81\n 1.45\n \n \n Lac\n mmol/L\n 2.32\n 2.42\n 2.19\n 2.66\n \n 6.15\n 5.46\n 1.33\n 1.78\n \n \n CRP\n mg/L\n 43.6\n 38.6\n 28.6\n 21.5\n \n 4.3\n 6.4\n 0.0\n 5.0\n \n \n PCT\n ng/mL\n 0.57\n \n 1.35\n 2.26\n 1.79\n 3.48\n 5.92\n \n 0.05\n \n \n IL-6\n \n \n \n 165.9\n 58.3\n 74.6\n 737.2\n \n \n 7.0\n \n \n CD3+CD4+\n T cells per µL\n \n 174\n 153\n 184\n 243\n 370\n 252\n 706.0\n 1125.0\n \n \n CD3+CD8+\n T cells per µL\n \n 142\n 135\n 126\n 132\n 511\n 410\n 323.0\n 836.0\n \n\n\n\n\n\n\n \n\n\nThe constants dataset contains values for hundreds of fundamental physical constants. We’ll take a subset of values that have some molar basis and generate a new display table from that. Like the illness dataset, this one has a units column so, again, the fmt_units() method will be used to format those units. Here, the preference for typesetting measurement units is to have positive and negative exponents (e.g., not \"<unit_1> / <unit_2>\" but rather \"<unit_1> <unit_2>^-1\").\n\nfrom great_tables.data import constants\nimport polars as pl\nimport polars.selectors as cs\n\nconstants_mini = (\n pl.from_pandas(constants)\n .filter(pl.col(\"name\").str.contains(\"molar\")).sort(\"value\")\n .with_columns(\n name=pl.col(\"name\")\n .str.to_titlecase()\n .str.replace(\"Kpa\", \"kpa\")\n .str.replace(\"Of\", \"of\")\n )\n)\n\n(\n GT(constants_mini)\n .cols_hide(columns=[\"uncert\", \"sf_value\", \"sf_uncert\"])\n .fmt_units(columns=\"units\")\n .fmt_scientific(columns=\"value\", decimals=3)\n .tab_header(title=\"Physical Constants Having a Molar Basis\")\n .tab_options(column_labels_hidden=True)\n)\n\n\n\n\n\n\n \n Physical Constants Having a Molar Basis\n \n\n\n\n \n Molar Planck Constant\n 3.990 × 10−10\n J Hz−1 mol−1\n \n \n Electron Molar Mass\n 5.486 × 10−7\n kg mol−1\n \n \n Molar Volume of Silicon\n 1.206 × 10−5\n m3 mol−1\n \n \n Muon Molar Mass\n 1.134 × 10−4\n kg mol−1\n \n \n Molar Mass Constant\n 1.000 × 10−3\n kg mol−1\n \n \n Proton Molar Mass\n 1.007 × 10−3\n kg mol−1\n \n \n Neutron Molar Mass\n 1.009 × 10−3\n kg mol−1\n \n \n Tau Molar Mass\n 1.908 × 10−3\n kg mol−1\n \n \n Deuteron Molar Mass\n 2.014 × 10−3\n kg mol−1\n \n \n Helion Molar Mass\n 3.015 × 10−3\n kg mol−1\n \n \n Triton Molar Mass\n 3.016 × 10−3\n kg mol−1\n \n \n Alpha Particle Molar Mass\n 4.002 × 10−3\n kg mol−1\n \n \n Molar Mass of Carbon-12\n 1.200 × 10−2\n kg mol−1\n \n \n Molar Volume of Ideal Gas (273.15 K, 101.325 kpa)\n 2.241 × 10−2\n m3 mol−1\n \n \n Molar Volume of Ideal Gas (273.15 K, 100 kpa)\n 2.271 × 10−2\n m3 mol−1\n \n \n Molar Gas Constant\n 8.314\n J mol−1 K−1\n \n\n\n\n\n\n\n \n\n\n\n\nSee Also\nThe define_units() function can be used as a standalone utility for working with units notation. It can parses strings in units notation and can emit formatted units with its .to_html() method.\n\n\n\nopt_align_table_header\nGT.opt_align_table_header(self, align='center')\nOption to align the table header.\nBy default, an added table header will have center alignment for both the title and the subtitle elements. This method allows us to easily set the horizontal alignment of the title and subtitle to the left, right, or center by using the \"align\" argument. This method serves as a convenient shortcut for gt.tab_options(heading_align=<align>).\n\nParameters\n\n\n\n\n\n\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\nalign\nstr\nThe alignment of the title and subtitle elements in the table header. Options are \"center\" (the default), \"left\", or \"right\".\n'center'\n\n\n\n\n\nReturns\n\n\n\nType\nDescription\n\n\n\n\nGT\nThe GT object is returned. This is the same object that the method is called on so that we can facilitate method chaining.\n\n\n\n\n\nExamples\nUsing select columns from the exibble dataset, let’s create a table with a number of components added. Following that, we’ll align the header contents (consisting of the title and the subtitle) to the left with the opt_align_table_header() method.\n\nfrom great_tables import GT, exibble, md\n\n(\n GT(\n exibble[[\"num\", \"char\", \"currency\", \"row\", \"group\"]],\n rowname_col=\"row\",\n groupname_col=\"group\"\n )\n .tab_header(\n title=md(\"Data listing from **exibble**\"),\n subtitle=md(\"`exibble` is a **Great Tables** dataset.\")\n )\n .fmt_number(columns=\"num\")\n .fmt_currency(columns=\"currency\")\n .tab_source_note(source_note=\"This is only a subset of the dataset.\")\n .opt_align_table_header(align=\"left\")\n)\n\n\n\n\n\n\n \n Data listing from exibble\n \n \n exibble is a Great Tables dataset.\n \n\n \n num\n char\n currency\n\n\n\n \n grp_a\n \n \n row_1\n 0.11\n apricot\n $49.95\n \n \n row_2\n 2.22\n banana\n $17.95\n \n \n row_3\n 33.33\n coconut\n $1.39\n \n \n row_4\n 444.40\n durian\n $65,100.00\n \n \n grp_b\n \n \n row_5\n 5,550.00\n \n $1,325.81\n \n \n row_6\n \n fig\n $13.26\n \n \n row_7\n 777,000.00\n grapefruit\n \n \n \n row_8\n 8,880,000.00\n honeydew\n $0.44\n \n\n \n \n \n This is only a subset of the dataset.\n \n\n\n\n\n\n\n \n\n\n\n\n\nopt_all_caps\nGT.opt_all_caps(self, all_caps=True, locations=['column_labels', 'stub', 'row_group'])\nOption to use all caps in select table locations.\nSometimes an all-capitalized look is suitable for a table. By using opt_all_caps(), we can transform characters in the column labels, the stub, and in all row groups in this way (and there’s control over which of these locations are transformed). This method serves as a convenient shortcut for tab_options(<location>_text_transform=\"uppercase\", <location>_font_size=\"80%\", <location>_font_weight=\"bolder\") (for all locations selected).\n\nParameters\n\n\n\n\n\n\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\nall_caps\nbool\nIndicates whether the text transformation to all caps should be performed (True, the default) or reset to default values (False) for the locations targeted.\nTrue\n\n\nlocations\nstr | list[str]\nWhich locations should undergo this text transformation? By default it includes all of the \"column_labels\", the \"stub\", and the \"row_group\" locations. However, we could just choose one or two of those.\n['column_labels', 'stub', 'row_group']\n\n\n\n\n\nReturns\n\n\n\nType\nDescription\n\n\n\n\nGT\nThe GT object is returned. This is the same object that the method is called on so that we can facilitate method chaining.\n\n\n\n\n\nExamples\nUsing select columns from the exibble dataset, let’s create a table with a number of components added. Following that, we’ll ensure that all text in the column labels, the stub, and in all row groups is transformed to all caps using the opt_all_caps() method.\n\nfrom great_tables import GT, exibble, md\n\n(\n GT(\n exibble[[\"num\", \"char\", \"currency\", \"row\", \"group\"]],\n rowname_col=\"row\",\n groupname_col=\"group\"\n )\n .tab_header(\n title=md(\"Data listing from **exibble**\"),\n subtitle=md(\"`exibble` is a **Great Tables** dataset.\")\n )\n .fmt_number(columns=\"num\")\n .fmt_currency(columns=\"currency\")\n .tab_source_note(source_note=\"This is only a subset of the dataset.\")\n .opt_all_caps()\n)\n\n\n\n\n\n\n \n Data listing from exibble\n \n \n exibble is a Great Tables dataset.\n \n\n \n num\n char\n currency\n\n\n\n \n grp_a\n \n \n row_1\n 0.11\n apricot\n $49.95\n \n \n row_2\n 2.22\n banana\n $17.95\n \n \n row_3\n 33.33\n coconut\n $1.39\n \n \n row_4\n 444.40\n durian\n $65,100.00\n \n \n grp_b\n \n \n row_5\n 5,550.00\n \n $1,325.81\n \n \n row_6\n \n fig\n $13.26\n \n \n row_7\n 777,000.00\n grapefruit\n \n \n \n row_8\n 8,880,000.00\n honeydew\n $0.44\n \n\n \n \n \n This is only a subset of the dataset.\n \n\n\n\n\n\n\n \n\n\n\n\n\nopt_footnote_marks\nGT.opt_footnote_marks(self, marks='numbers')\nOption to modify the set of footnote marks Alter the footnote marks for any footnotes that may be present in the table. Either a list of marks can be provided (including Unicode characters), or, a specific keyword could be used to signify a preset sequence. This method serves as a shortcut for using tab_options(footnotes_marks=<marks>)\nWe can supply a list of strings will represent the series of marks. The series of footnote marks is recycled when its usage goes beyond the length of the set. At each cycle, the marks are simply doubled, tripled, and so on (e.g., * -> ** -> ***). The option exists for providing keywords for certain types of footnote marks. The keywords are\n\n\"numbers\": numeric marks, they begin from 1 and these marks are not subject to recycling behavior\n\"letters\": lowercase alphabetic marks. Same as using the gt.letters() function which produces a list of 26 lowercase letters from the Roman alphabet\n\"LETTERS\": uppercase alphabetic marks. Same as using the gt.LETTERS() function which produces a list of 26 uppercase letters from the Roman alphabet\n\"standard\": symbolic marks, four symbols in total\n\"extended\": symbolic marks, extends the standard set by adding two more symbols, making six\n\n\nParameters\n\n\n\n\n\n\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\nmarks\nstr | list[str]\nEither a list of strings that will represent the series of marks or a keyword string that represents a preset sequence of marks. The valid keywords are: \"numbers\" (for numeric marks), \"letters\" and \"LETTERS\" (for lowercase and uppercase alphabetic marks), \"standard\" (for a traditional set of four symbol marks), and \"extended\" (which adds two more symbols to the standard set).\n'numbers'\n\n\n\n\n\nReturns\n\n\n\nType\nDescription\n\n\n\n\nGT\nThe GT object is returned. This is the same object that the method is called on so that we can facilitate method chaining.\n\n\n\n\n\n\nopt_horizontal_padding\nGT.opt_horizontal_padding(self, scale=1.0)\nOption to scale the horizontal padding of the table.\nThis method allows us to scale the horizontal padding of the table by a factor of scale. The default value is 1.0 and this method serves as a convenient shortcut for gt.tab_options( heading_padding_horizontal=<new_val>, column_labels_padding_horizontal=<new_val>, data_row_padding_horizontal=<new_val>, row_group_padding_horizontal=<new_val>, source_notes_padding_horizontal=<new_val>).\n\nParameters\n\n\n\n\n\n\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\nscale\nfloat\nThe factor by which to scale the horizontal padding. The default value is 1.0. A value less than 1.0 will reduce the padding, and a value greater than 1.0 will increase the padding. The value must be between 0 and 3.\n1.0\n\n\n\n\n\nReturns\n\n\n\nType\nDescription\n\n\n\n\nGT\nThe GT object is returned. This is the same object that the method is called on so that we can facilitate method chaining.\n\n\n\n\n\nExamples\nUsing select columns from the exibble dataset, let’s create a table with a number of components added. Following that, we’ll scale the horizontal padding of the table by a factor of 3 using the opt_horizontal_padding() method.\n\nfrom great_tables import GT, exibble, md\n\ngt_tbl = (\n GT(\n exibble[[\"num\", \"char\", \"currency\", \"row\", \"group\"]],\n rowname_col=\"row\",\n groupname_col=\"group\"\n )\n .tab_header(\n title=md(\"Data listing from **exibble**\"),\n subtitle=md(\"`exibble` is a **Great Tables** dataset.\")\n )\n .fmt_number(columns=\"num\")\n .fmt_currency(columns=\"currency\")\n .tab_source_note(source_note=\"This is only a subset of the dataset.\")\n)\n\ngt_tbl.opt_horizontal_padding(scale=3)\n\n\n\n\n\n\n \n Data listing from exibble\n \n \n exibble is a Great Tables dataset.\n \n\n \n num\n char\n currency\n\n\n\n \n grp_a\n \n \n row_1\n 0.11\n apricot\n $49.95\n \n \n row_2\n 2.22\n banana\n $17.95\n \n \n row_3\n 33.33\n coconut\n $1.39\n \n \n row_4\n 444.40\n durian\n $65,100.00\n \n \n grp_b\n \n \n row_5\n 5,550.00\n \n $1,325.81\n \n \n row_6\n \n fig\n $13.26\n \n \n row_7\n 777,000.00\n grapefruit\n \n \n \n row_8\n 8,880,000.00\n honeydew\n $0.44\n \n\n \n \n \n This is only a subset of the dataset.\n \n\n\n\n\n\n\n \n\n\nThe overall effect of scaling the horizontal padding is that the table will appear wider or and there will added buffer space between the table elements. The overall look of the table will be more spacious and neigboring pieces of text will be less cramped.\nLet’s go the other way and scale the horizontal padding of the table by a factor of 0.5 using the opt_horizontal_padding() method.\n\ngt_tbl.opt_horizontal_padding(scale=0.5)\n\n\n\n\n\n\n \n Data listing from exibble\n \n \n exibble is a Great Tables dataset.\n \n\n \n num\n char\n currency\n\n\n\n \n grp_a\n \n \n row_1\n 0.11\n apricot\n $49.95\n \n \n row_2\n 2.22\n banana\n $17.95\n \n \n row_3\n 33.33\n coconut\n $1.39\n \n \n row_4\n 444.40\n durian\n $65,100.00\n \n \n grp_b\n \n \n row_5\n 5,550.00\n \n $1,325.81\n \n \n row_6\n \n fig\n $13.26\n \n \n row_7\n 777,000.00\n grapefruit\n \n \n \n row_8\n 8,880,000.00\n honeydew\n $0.44\n \n\n \n \n \n This is only a subset of the dataset.\n \n\n\n\n\n\n\n \n\n\nWhat you get in this case is more condensed text across the horizontal axis. This may not always be desired when cells consist mainly of text, but it could be useful when the table is more visual and the cells are filled with graphics or other non-textual elements.\n\n\n\nopt_row_striping\nGT.opt_row_striping(self, row_striping=True)\nOption to add or remove row striping.\nBy default, a table does not have row striping enabled. However, this method allows us to easily enable or disable striped rows in the table body. It’s a convenient shortcut for tab_options(row_striping_include_table_body=<True|False>).\n\nParameters\n\n\n\n\n\n\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\nrow_striping\nbool\nA boolean that indicates whether row striping should be added or removed. Defaults to True.\nTrue\n\n\n\n\n\nReturns\n\n\n\nType\nDescription\n\n\n\n\nGT\nThe GT object is returned. This is the same object that the method is called on so that we can facilitate method chaining.\n\n\n\n\n\nExamples\nUsing only a few columns from the exibble dataset, let’s create a table with a number of components added. Following that, we’ll add row striping to every second row with the opt_row_striping() method.\n\nfrom great_tables import GT, exibble, md\n\n(\n GT(\n exibble[[\"num\", \"char\", \"currency\", \"row\", \"group\"]],\n rowname_col=\"row\",\n groupname_col=\"group\"\n )\n .tab_header(\n title=md(\"Data listing from **exibble**\"),\n subtitle=md(\"`exibble` is a **Great Tables** dataset.\")\n )\n .fmt_number(columns=\"num\")\n .fmt_currency(columns=\"currency\")\n .tab_source_note(source_note=\"This is only a subset of the dataset.\")\n .opt_row_striping()\n)\n\n\n\n\n\n\n \n Data listing from exibble\n \n \n exibble is a Great Tables dataset.\n \n\n \n num\n char\n currency\n\n\n\n \n grp_a\n \n \n row_1\n 0.11\n apricot\n $49.95\n \n \n row_2\n 2.22\n banana\n $17.95\n \n \n row_3\n 33.33\n coconut\n $1.39\n \n \n row_4\n 444.40\n durian\n $65,100.00\n \n \n grp_b\n \n \n row_5\n 5,550.00\n \n $1,325.81\n \n \n row_6\n \n fig\n $13.26\n \n \n row_7\n 777,000.00\n grapefruit\n \n \n \n row_8\n 8,880,000.00\n honeydew\n $0.44\n \n\n \n \n \n This is only a subset of the dataset.\n \n\n\n\n\n\n\n \n\n\n\n\n\nopt_stylize\nGT.opt_stylize(self, style=1, color='blue', add_row_striping=True)\nStylize your table with a colorful look.\nWith the opt_stylize() method you can quickly style your table with a carefully curated set of background colors, line colors, and line styles. There are six styles to choose from and they largely vary in the extent of coloring applied to different table locations. Some have table borders applied, some apply darker colors to the table stub and summary sections, and, some even have vertical lines. In addition to choosing a style preset, there are six color variations that each use a range of five color tints. Each of the color tints have been fine-tuned to maximize the contrast between text and its background. There are 36 combinations of style and color to choose from. For examples of each style, see the Premade Themes section of the Get Started guide.\n\nParameters\n\n\n\n\n\n\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\nstyle\nint\nSix numbered styles are available. Simply provide a number from 1 (the default) to 6 to choose a distinct look.\n1\n\n\ncolor\nstr\nThe color scheme of the table. The default value is \"blue\". The valid values are \"blue\", \"cyan\", \"pink\", \"green\", \"red\", and \"gray\".\n'blue'\n\n\nadd_row_striping\nbool\nAn option to enable row striping in the table body for the style chosen.\nTrue\n\n\n\n\n\nReturns\n\n\n\nType\nDescription\n\n\n\n\nGT\nThe GT object is returned. This is the same object that the method is called on so that we can facilitate method chaining.\n\n\n\n\n\nExamples\nUsing select columns from the exibble dataset, let’s create a table with a number of components added. Following that, we’ll apply a predefined style to the table using the opt_stylize() method.\n\nfrom great_tables import GT, exibble, md\n\ngt_tbl = (\n GT(\n exibble[[\"num\", \"char\", \"currency\", \"row\", \"group\"]],\n rowname_col=\"row\",\n groupname_col=\"group\"\n )\n .tab_header(\n title=md(\"Data listing from **exibble**\"),\n subtitle=md(\"`exibble` is a **Great Tables** dataset.\")\n )\n .fmt_number(columns=\"num\")\n .fmt_currency(columns=\"currency\")\n .tab_source_note(source_note=\"This is only a subset of the dataset.\")\n .opt_stylize()\n )\n\ngt_tbl\n\n\n\n\n\n\n \n Data listing from exibble\n \n \n exibble is a Great Tables dataset.\n \n\n \n num\n char\n currency\n\n\n\n \n grp_a\n \n \n row_1\n 0.11\n apricot\n $49.95\n \n \n row_2\n 2.22\n banana\n $17.95\n \n \n row_3\n 33.33\n coconut\n $1.39\n \n \n row_4\n 444.40\n durian\n $65,100.00\n \n \n grp_b\n \n \n row_5\n 5,550.00\n \n $1,325.81\n \n \n row_6\n \n fig\n $13.26\n \n \n row_7\n 777,000.00\n grapefruit\n \n \n \n row_8\n 8,880,000.00\n honeydew\n $0.44\n \n\n \n \n \n This is only a subset of the dataset.\n \n\n\n\n\n\n\n \n\n\nThe table has been stylized with the default style and color. The default style is 1 and the default color is \"blue\". The resulting table style is a combination of color and border settings that are applied to the table.\nWe can modify the overall style and choose a different color theme by providing different values to the style= and color= arguments.\n\ngt_tbl.opt_stylize(style=2, color=\"green\")\n\n\n\n\n\n\n \n Data listing from exibble\n \n \n exibble is a Great Tables dataset.\n \n\n \n num\n char\n currency\n\n\n\n \n grp_a\n \n \n row_1\n 0.11\n apricot\n $49.95\n \n \n row_2\n 2.22\n banana\n $17.95\n \n \n row_3\n 33.33\n coconut\n $1.39\n \n \n row_4\n 444.40\n durian\n $65,100.00\n \n \n grp_b\n \n \n row_5\n 5,550.00\n \n $1,325.81\n \n \n row_6\n \n fig\n $13.26\n \n \n row_7\n 777,000.00\n grapefruit\n \n \n \n row_8\n 8,880,000.00\n honeydew\n $0.44\n \n\n \n \n \n This is only a subset of the dataset.\n \n\n\n\n\n\n\n \n\n\n\n\n\nopt_table_font\nGT.opt_table_font(self, font=None, stack=None, weight=None, style=None, add=True)\nOptions to define font choices for the entire table.\nThe opt_table_font() method makes it possible to define fonts used for an entire table. Any font names supplied in font= will (by default, with add=True) be placed before the names present in the existing font stack (i.e., they will take precedence). You can choose to base the font stack on those provided by the system_fonts() helper function by providing a valid keyword for a themed set of fonts. Take note that you could still have entirely different fonts in specific locations of the table. To make that possible you would need to use tab_style() in conjunction with style.text().\n\nParameters\n\n\n\n\n\n\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\nfont\nstr | list[str] | dict[str, str] | None\nOne or more font names available on the user system. This can be a string or a list of strings. The default value is None since you could instead opt to use stack to define a list of fonts.\nNone\n\n\nstack\nFontStackName | None\nA name that is representative of a font stack (obtained via internally via the system_fonts() helper function. If provided, this new stack will replace any defined fonts and any font= values will be prepended.\nNone\n\n\nstyle\nstr | None\nAn option to modify the text style. Can be one of either \"normal\", \"italic\", or \"oblique\".\nNone\n\n\nweight\nstr | int | float | None\nOption to set the weight of the font. Can be a text-based keyword such as \"normal\", \"bold\", \"lighter\", \"bolder\", or, a numeric value between 1 and 1000. Please note that typefaces have varying support for the numeric mapping of weight.\nNone\n\n\nadd\nbool\nShould fonts be added to the beginning of any already-defined fonts for the table? By default, this is True and is recommended since those fonts already present can serve as fallbacks when everything specified in font is not available. If a stack= value is provided, then add will automatically set to False.\nTrue\n\n\n\n\n\nReturns\n\n\n\nType\nDescription\n\n\n\n\nGT\nThe GT object is returned. This is the same object that the method is called on so that we can facilitate method chaining.\n\n\n\n\n\nPossibilities For The Stack Argument\nThere are several themed font stacks available via the system_fonts() helper function. That function can be used to generate all or a segment of a list supplied to the font= argument. However, using the stack= argument with one of the 15 keywords for the font stacks available in system_fonts(), we could be sure that the typeface class will work across multiple computer systems. Any of the following keywords can be used with stack=:\n\n\"system-ui\"\n\"transitional\"\n\"old-style\"\n\"humanist\"\n\"geometric-humanist\"\n\"classical-humanist\"\n\"neo-grotesque\"\n\"monospace-slab-serif\"\n\"monospace-code\"\n\"industrial\"\n\"rounded-sans\"\n\"slab-serif\"\n\"antique\"\n\"didone\"\n\"handwritten\"\n\n\n\nExamples\nLet’s use a subset of the sp500 dataset to create a small table. With opt_table_font() we can add some preferred font choices for modifying the text of the entire table. Here we’ll use the \"Superclarendon\" and \"Georgia\" fonts (the second font serves as a fallback).\n\nimport polars as pl\nfrom great_tables import GT\nfrom great_tables.data import sp500\n\nsp500_mini = pl.from_pandas(sp500).slice(0, 10).drop([\"volume\", \"adj_close\"])\n\n(\n GT(sp500_mini, rowname_col=\"date\")\n .fmt_currency(use_seps=False)\n .opt_table_font(font=[\"Superclarendon\", \"Georgia\"])\n)\n\n\n\n\n\n\n\n \n open\n high\n low\n close\n\n\n\n \n 2015-12-31\n $2060.59\n $2062.54\n $2043.62\n $2043.94\n \n \n 2015-12-30\n $2077.34\n $2077.34\n $2061.97\n $2063.36\n \n \n 2015-12-29\n $2060.54\n $2081.56\n $2060.54\n $2078.36\n \n \n 2015-12-28\n $2057.77\n $2057.77\n $2044.20\n $2056.50\n \n \n 2015-12-24\n $2063.52\n $2067.36\n $2058.73\n $2060.99\n \n \n 2015-12-23\n $2042.20\n $2064.73\n $2042.20\n $2064.29\n \n \n 2015-12-22\n $2023.15\n $2042.74\n $2020.49\n $2038.97\n \n \n 2015-12-21\n $2010.27\n $2022.90\n $2005.93\n $2021.15\n \n \n 2015-12-18\n $2040.81\n $2040.81\n $2005.33\n $2005.55\n \n \n 2015-12-17\n $2073.76\n $2076.37\n $2041.66\n $2041.89\n \n\n\n\n\n\n\n \n\n\nIn practice, both of these fonts are not likely to be available on all systems. The opt_table_font() method safeguards against this by prepending the fonts in the font= list to the existing font stack. This way, if both fonts are not available, the table will fall back to using the list of default table fonts. This behavior is controlled by the add= argument, which is True by default.\nWith the sza dataset we’ll create a two-column, eleven-row table. Within opt_table_font(), the stack= argument will be supplied with the “rounded-sans” font stack. This sets up a family of fonts with rounded, curved letterforms that should be locally available in different computing environments.\n\nfrom great_tables.data import sza\n\nsza_mini = (\n pl.from_pandas(sza)\n .filter((pl.col(\"latitude\") == \"20\") & (pl.col(\"month\") == \"jan\"))\n .drop_nulls()\n .drop([\"latitude\", \"month\"])\n)\n\n(\n GT(sza_mini)\n .opt_table_font(stack=\"rounded-sans\")\n .opt_all_caps()\n)\n\n\n\n\n\n\n\n tst\n sza\n\n\n\n \n 0700\n 84.9\n \n \n 0730\n 78.7\n \n \n 0800\n 72.7\n \n \n 0830\n 66.1\n \n \n 0900\n 61.5\n \n \n 0930\n 56.5\n \n \n 1000\n 52.1\n \n \n 1030\n 48.3\n \n \n 1100\n 45.5\n \n \n 1130\n 43.6\n \n \n 1200\n 43.0\n \n\n\n\n\n\n\n \n\n\n\n\n\nopt_table_outline\nGT.opt_table_outline(self, style='solid', width='3px', color='#D3D3D3')\nOption to wrap an outline around the entire table.\nThe opt_table_outline() method puts an outline of consistent style=, width=, and color= around the entire table. It’ll write over any existing outside lines so long as the width= value is larger that of the existing lines. The default value of style= (\"solid\") will draw a solid outline, whereas using \"none\" will remove any present outline.\n\nParameters\n\n\n\n\n\n\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\nstyle\nstr\nThe style of the table outline. The default value is \"solid\". The valid values are \"solid\", \"dashed\", \"dotted\", and \"none\".\n'solid'\n\n\nwidth\nstr\nThe width of the table outline. The default value is \"3px\". The value must be in pixels and it must be an integer value.\n'3px'\n\n\ncolor\nstr\nThe color of the table outline, where the default is \"#D3D3D3\". The value must either a hexadecimal color code or a color name.\n'#D3D3D3'\n\n\n\n\n\nReturns\n\n\n\nType\nDescription\n\n\n\n\nGT\nThe GT object is returned. This is the same object that the method is called on so that we can facilitate method chaining.\n\n\n\n\n\nExamples\nUsing select columns from the exibble dataset, let’s create a table with a number of components added. Following that, we’ll put an outline around the entire table using the opt_table_outline() method.\n\nfrom great_tables import GT, exibble, md\n\n(\n GT(\n exibble[[\"num\", \"char\", \"currency\", \"row\", \"group\"]],\n rowname_col=\"row\",\n groupname_col=\"group\"\n )\n .tab_header(\n title=md(\"Data listing from **exibble**\"),\n subtitle=md(\"`exibble` is a **Great Tables** dataset.\")\n )\n .fmt_number(columns=\"num\")\n .fmt_currency(columns=\"currency\")\n .tab_source_note(source_note=\"This is only a subset of the dataset.\")\n .opt_table_outline()\n)\n\n\n\n\n\n\n \n Data listing from exibble\n \n \n exibble is a Great Tables dataset.\n \n\n \n num\n char\n currency\n\n\n\n \n grp_a\n \n \n row_1\n 0.11\n apricot\n $49.95\n \n \n row_2\n 2.22\n banana\n $17.95\n \n \n row_3\n 33.33\n coconut\n $1.39\n \n \n row_4\n 444.40\n durian\n $65,100.00\n \n \n grp_b\n \n \n row_5\n 5,550.00\n \n $1,325.81\n \n \n row_6\n \n fig\n $13.26\n \n \n row_7\n 777,000.00\n grapefruit\n \n \n \n row_8\n 8,880,000.00\n honeydew\n $0.44\n \n\n \n \n \n This is only a subset of the dataset.\n \n\n\n\n\n\n\n \n\n\n\n\n\nopt_vertical_padding\nGT.opt_vertical_padding(self, scale=1.0)\nOption to scale the vertical padding of the table.\nThis method allows us to scale the vertical padding of the table by a factor of scale. The default value is 1.0 and this method serves as a convenient shortcut for gt.tab_options(heading_padding=<new_val>, column_labels_padding=<new_val>, data_row_padding=<new_val>, row_group_padding=<new_val>, source_notes_padding=<new_val>).\n\nParameters\n\n\n\n\n\n\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\nscale\nfloat\nThe factor by which to scale the vertical padding. The default value is 1.0. A value less than 1.0 will reduce the padding, and a value greater than 1.0 will increase the padding. The value must be between 0 and 3.\n1.0\n\n\n\n\n\nReturns\n\n\n\nType\nDescription\n\n\n\n\nGT\nThe GT object is returned. This is the same object that the method is called on so that we can facilitate method chaining.\n\n\n\n\n\nExamples\nUsing select columns from the exibble dataset, let’s create a table with a number of components added. Following that, we’ll scale the vertical padding of the table by a factor of 3 using the opt_vertical_padding() method.\n\nfrom great_tables import GT, exibble, md\n\ngt_tbl = (\n GT(\n exibble[[\"num\", \"char\", \"currency\", \"row\", \"group\"]],\n rowname_col=\"row\",\n groupname_col=\"group\"\n )\n .tab_header(\n title=md(\"Data listing from **exibble**\"),\n subtitle=md(\"`exibble` is a **Great Tables** dataset.\")\n )\n .fmt_number(columns=\"num\")\n .fmt_currency(columns=\"currency\")\n .tab_source_note(source_note=\"This is only a subset of the dataset.\")\n)\n\ngt_tbl.opt_vertical_padding(scale=3)\n\n\n\n\n\n\n \n Data listing from exibble\n \n \n exibble is a Great Tables dataset.\n \n\n \n num\n char\n currency\n\n\n\n \n grp_a\n \n \n row_1\n 0.11\n apricot\n $49.95\n \n \n row_2\n 2.22\n banana\n $17.95\n \n \n row_3\n 33.33\n coconut\n $1.39\n \n \n row_4\n 444.40\n durian\n $65,100.00\n \n \n grp_b\n \n \n row_5\n 5,550.00\n \n $1,325.81\n \n \n row_6\n \n fig\n $13.26\n \n \n row_7\n 777,000.00\n grapefruit\n \n \n \n row_8\n 8,880,000.00\n honeydew\n $0.44\n \n\n \n \n \n This is only a subset of the dataset.\n \n\n\n\n\n\n\n \n\n\nNow that’s a tall table! The overall effect of scaling the vertical padding is that the table will appear taller and there will be more buffer space between the table elements. A value of 3 is pretty extreme and is likely to be too much in most cases, so, feel free to experiment with different values when looking to increase the vertical padding.\nLet’s go the other way (using a value less than 1) and try to condense the content vertically with a scale factor of 0.5. This will reduce the top and bottom padding globally and make the table appear more compact.\n\ngt_tbl.opt_vertical_padding(scale=0.5)\n\n\n\n\n\n\n \n Data listing from exibble\n \n \n exibble is a Great Tables dataset.\n \n\n \n num\n char\n currency\n\n\n\n \n grp_a\n \n \n row_1\n 0.11\n apricot\n $49.95\n \n \n row_2\n 2.22\n banana\n $17.95\n \n \n row_3\n 33.33\n coconut\n $1.39\n \n \n row_4\n 444.40\n durian\n $65,100.00\n \n \n grp_b\n \n \n row_5\n 5,550.00\n \n $1,325.81\n \n \n row_6\n \n fig\n $13.26\n \n \n row_7\n 777,000.00\n grapefruit\n \n \n \n row_8\n 8,880,000.00\n honeydew\n $0.44\n \n\n \n \n \n This is only a subset of the dataset.\n \n\n\n\n\n\n\n \n\n\nA value of 0.5 provides a reasonable amount of vertical padding and the table will appear more compact. This is useful when space is limited and, in such a situation, this is a practical solution to that problem.\n\n\n\nsave\nGT.save(self, file, selector='table', scale=1.0, expand=5, web_driver='chrome', window_size=(6000, 6000), debug_port=None, encoding='utf-8', _debug_dump=None)\nProduce a high-resolution image file or PDF of the table.\nThe output file is created by taking a screenshot of the table using a headless browser.\n\nParameters\n\n\n\n\n\n\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\nfile\nstr\nThe name of the file to save the image to. Accepts names ending with .png, .bmp, and other image extensions. Also accepts the extension .pdf.\nrequired\n\n\nselector\nstr\n(NOT IMPLEMENTED) The HTML element name used to select table. Defaults to the whole table.\n'table'\n\n\nscale\nfloat\nThe scaling factor that will be used when generating the image. Lower values decrease resolution. A scale of 2 is equivalent to doubling the width of the table in pixels. Note that higher resolution results in larger file sizes.\n1.0\n\n\nexpand\nint\n(NOT IMPLEMENTED) The number of pixels to expand the screenshot by. This can be increased to capture more of the surrounding area, or decreased to capture less.\n5\n\n\nweb_driver\nWebDrivers\nThe webdriver to use when taking the screenshot. By default, uses Google Chrome. Supports \"firefox\" (Mozilla Firefox), \"safari\" (Apple Safari), and \"edge\" (Microsoft Edge). Specified browser must be installed.\n'chrome'\n\n\nwindow_size\ntuple[int, int]\nThe size of the browser window to use when laying out the table. This shouldn’t be necessary to capture a table, but may affect the tables appearance.\n(6000, 6000)\n\n\ndebug_port\nNone | int\nPort number to use for debugging. By default no debugging port is opened.\nNone\n\n\nencoding\nstr\nThe encoding used when writing temporary files.\n'utf-8'\n\n\n_debug_dump\nDebugDumpOptions | None\nWhether the saved image should be a big browser window, with key elements outlined. This is helpful for debugging this function’s resizing, cropping heuristics. This is an internal parameter and subject to change.\nNone\n\n\n\n\n\nReturns\n\n\n\n\n\n\n\nType\nDescription\n\n\n\n\nNone\nThis function does not return anything; it simply saves the image to the specified file path.\n\n\n\n\n\nDetails\nWe create the output file based on the HTML version of the table.\nThis process is facilitated by two libraries:\n\nselenium, which is used to control the Chrome browser and take a screenshot of the table.\nPIL, which is used to crop the screenshot to only include the table element of the page.\n\nBoth of these packages needs to be installed before attempting to save any table as an image file. The selenium package also requires the Chrome browser to be installed on the system.\nA pip-based reinstallation of Great Tables through the following command will install these required packages:\npip install great_tables[extra]\n\n\n\nshow\nGT.show(self, target='auto')\nDisplay the table in a notebook or a web browser.\nNote that this function is often unecessary in a notebook. However, it’s sometimes useful for manually triggering display within a code cell.\n\nParameters\n\n\n\n\n\n\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\ntarget\nLiteral[‘auto’, ‘notebook’, ‘browser’]\nWhere to show the table. If “auto”, infer whether the table can be displayed inline (e.g. in a notebook), or whether a browser is needed (e.g. in a console).\n'auto'\n\n\n\n\n\nExamples\nThe example below when in the Great Tables documentation, should appear on the page.\n\nfrom great_tables import GT, exibble\n\nGT(exibble.head(2)).show()\nGT(exibble.tail(2)).show()\n\n\n\n\n\n\n\n num\n char\n fctr\n date\n time\n datetime\n currency\n row\n group\n\n\n\n \n 0.1111\n apricot\n one\n 2015-01-15\n 13:35\n 2018-01-01 02:22\n 49.95\n row_1\n grp_a\n \n \n 2.222\n banana\n two\n 2015-02-15\n 14:40\n 2018-02-02 14:33\n 17.95\n row_2\n grp_a\n \n\n\n\n\n\n\n \n\n\n\n\n\n\n\n\n num\n char\n fctr\n date\n time\n datetime\n currency\n row\n group\n\n\n\n \n 777000.0\n grapefruit\n seven\n \n 19:10\n 2018-07-07 05:22\n \n row_7\n grp_b\n \n \n 8880000.0\n honeydew\n eight\n 2015-08-15\n 20:20\n \n 0.44\n row_8\n grp_b\n \n\n\n\n\n\n\n \n\n\n\n\n\nsub_missing\nGT.sub_missing(self, columns=None, rows=None, missing_text=None)\nSubstitute missing values in the table body.\nWherever there is missing data (i.e., None values) customizable content may present better than the standard representation of missing values that would otherwise appear. The sub_missing() method allows for this replacement through its missing_text= argument. And by not supplying anything to missing_text=, an em dash will serve as a default indicator of missingness.\n\nParameters\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\ncolumns\nSelectExpr\nThe columns to target. Can either be a single column name or a series of column names provided in a list.\nNone\n\n\nrows\nint | list[int] | None\nIn conjunction with columns=, we can specify which of their rows should be scanned for missing values. The default is all rows, resulting in all rows in all targeted columns being considered for this substitution. Alternatively, we can supply a list of row indices.\nNone\n\n\nmissing_text\nstr | Text | None\nThe text to be used in place of missing values in the rendered table. We can optionally use the md() or html() helper functions to style the text as Markdown or to retain HTML elements in the text.\nNone\n\n\n\n\n\nReturns\n\n\n\nType\nDescription\n\n\n\n\nGT\nThe GT object is returned. This is the same object that the method is called on so that we can facilitate method chaining.\n\n\n\n\n\nExamples\nUsing a subset of the exibble dataset, let’s create a new table. The missing values in two selections of columns will be given different variations of replacement text (across two separate calls of sub_missing()).\n\nfrom great_tables import GT, md, html, exibble\nimport polars as pl\nimport polars.selectors as cs\n\nexibble_mini = pl.from_pandas(exibble).drop(\"row\", \"group\", \"fctr\").slice(4, 8)\n\n(\n GT(exibble_mini)\n .sub_missing(\n columns=[\"num\", \"char\"],\n missing_text=\"missing\"\n )\n .sub_missing(\n columns=cs.contains((\"date\", \"time\")) | cs.by_name(\"currency\"),\n missing_text=\"nothing\"\n )\n)\n\n\n\n\n\n\n\n num\n char\n date\n time\n datetime\n currency\n\n\n\n \n 5550.0\n missing\n 2015-05-15\n 17:55\n 2018-05-05 04:00\n 1325.81\n \n \n missing\n fig\n 2015-06-15\n nothing\n 2018-06-06 16:11\n 13.255\n \n \n 777000.0\n grapefruit\n nothing\n 19:10\n 2018-07-07 05:22\n nothing\n \n \n 8880000.0\n honeydew\n 2015-08-15\n 20:20\n nothing\n 0.44\n \n\n\n\n\n\n\n \n\n\n\n\n\nsub_zero\nGT.sub_zero(self, columns=None, rows=None, zero_text='nil')\nSubstitute zero values in the table body.\nWherever there is numerical data that are zero in value, replacement text may be better for explanatory purposes. The sub_zero() function allows for this replacement through its zero_text= argument.\n\nParameters\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\ncolumns\nSelectExpr\nThe columns to target. Can either be a single column name or a series of column names provided in a list.\nNone\n\n\nrows\nint | list[int] | None\nIn conjunction with columns=, we can specify which of their rows should be scanned for zeros. The default is all rows, resulting in all rows in all targeted columns being considered for this substitution. Alternatively, we can supply a list of row indices.\nNone\n\n\nzero_text\nstr\nThe text to be used in place of zero values in the rendered table. We can optionally use the md() or html() functions to style the text as Markdown or to retain HTML elements in the text.\n'nil'\n\n\n\n\n\nReturns\n\n\n\nType\nDescription\n\n\n\n\nGT\nThe GT object is returned. This is the same object that the method is called on so that we can facilitate method chaining.\n\n\n\n\n\nExamples\nLet’s generate a simple table that contains an assortment of values that could potentially undergo some substitution via the sub_zero() method (i.e., there are two 0 values). The ordering of the fmt_scientific() and sub_zero() calls in the example below doesn’t affect the final result since any sub_*() method won’t interfere with the formatting of the table.\n\nfrom great_tables import GT\nimport polars as pl\n\nsingle_vals_df = pl.DataFrame(\n {\n \"i\": range(1, 8),\n \"numbers\": [2.75, 0, -3.2, 8, 1e-10, 0, 2.6e9]\n }\n)\n\nGT(single_vals_df).fmt_scientific(columns=\"numbers\").sub_zero()\n\n\n\n\n\n\n\n i\n numbers\n\n\n\n \n 1\n 2.75\n \n \n 2\n nil\n \n \n 3\n −3.20\n \n \n 4\n 8.00\n \n \n 5\n 1.00 × 10−10\n \n \n 6\n nil\n \n \n 7\n 2.60 × 109\n \n\n\n\n\n\n\n \n\n\n\n\n\ntab_header\nGT.tab_header(self, title, subtitle=None, preheader=None)\nAdd a table header.\nWe can add a table header to the output table that contains a title and even a subtitle with the tab_header() method. A table header is an optional table component that is positioned above the column labels. We have the flexibility to use Markdown or HTML formatting for the header’s title and subtitle with the md() and html() helper functions.\n\nParameters\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\ntitle\nstr | Text\nText to be used in the table title. We can elect to use the md() and html() helper functions to style the text as Markdown or to retain HTML elements in the text.\nrequired\n\n\nsubtitle\nstr | Text | None\nText to be used in the table subtitle. We can elect to use the md() and html() helper functions to style the text as Markdown or to retain HTML elements in the text.\nNone\n\n\npreheader\nstr | list[str] | None\nOptional preheader content that is rendered above the table. Can be supplied as a list of strings.\nNone\n\n\n\n\n\nReturns\n\n\n\nType\nDescription\n\n\n\n\nGT\nThe GT object is returned. This is the same object that the method is called on so that we can facilitate method chaining.\n\n\n\n\n\nExamples\nLet’s use a small portion of the gtcars dataset to create a table. A header part can be added to the table with the tab_header() method. We’ll add a title and the optional subtitle as well. With the md() helper function, we can make sure the Markdown formatting is interpreted and transformed.\n\nfrom great_tables import GT, md\nfrom great_tables.data import gtcars\n\ngtcars_mini = gtcars[[\"mfr\", \"model\", \"msrp\"]].head(5)\n\n(\n GT(gtcars_mini)\n .tab_header(\n title=md(\"Data listing from **gtcars**\"),\n subtitle=md(\"`gtcars` is an R dataset\")\n )\n)\n\n\n\n\n\n\n \n Data listing from gtcars\n \n \n gtcars is an R dataset\n \n\n mfr\n model\n msrp\n\n\n\n \n Ford\n GT\n 447000.0\n \n \n Ferrari\n 458 Speciale\n 291744.0\n \n \n Ferrari\n 458 Spider\n 263553.0\n \n \n Ferrari\n 458 Italia\n 233509.0\n \n \n Ferrari\n 488 GTB\n 245400.0\n \n\n\n\n\n\n\n \n\n\nWe can alternatively use the html() helper function to retain HTML elements in the text.\n\nfrom great_tables import GT, md, html\nfrom great_tables.data import gtcars\n\ngtcars_mini = gtcars[[\"mfr\", \"model\", \"msrp\"]].head(5)\n\n(\n GT(gtcars_mini)\n .tab_header(\n title=md(\"Data listing <strong>gtcars</strong>\"),\n subtitle=html(\"From <span style='color:red;'>gtcars</span>\")\n )\n)\n\n\n\n\n\n\n \n Data listing gtcars\n \n \n From gtcars\n \n\n mfr\n model\n msrp\n\n\n\n \n Ford\n GT\n 447000.0\n \n \n Ferrari\n 458 Speciale\n 291744.0\n \n \n Ferrari\n 458 Spider\n 263553.0\n \n \n Ferrari\n 458 Italia\n 233509.0\n \n \n Ferrari\n 488 GTB\n 245400.0\n \n\n\n\n\n\n\n \n\n\n\n\n\ntab_options\nGT.tab_options(self, container_width=None, container_height=None, container_overflow_x=None, container_overflow_y=None, table_width=None, table_layout=None, table_margin_left=None, table_margin_right=None, table_background_color=None, table_additional_css=None, table_font_names=None, table_font_size=None, table_font_weight=None, table_font_style=None, table_font_color=None, table_font_color_light=None, table_border_top_style=None, table_border_top_width=None, table_border_top_color=None, table_border_bottom_style=None, table_border_bottom_width=None, table_border_bottom_color=None, table_border_left_style=None, table_border_left_width=None, table_border_left_color=None, table_border_right_style=None, table_border_right_width=None, table_border_right_color=None, heading_background_color=None, heading_align=None, heading_title_font_size=None, heading_title_font_weight=None, heading_subtitle_font_size=None, heading_subtitle_font_weight=None, heading_padding=None, heading_padding_horizontal=None, heading_border_bottom_style=None, heading_border_bottom_width=None, heading_border_bottom_color=None, heading_border_lr_style=None, heading_border_lr_width=None, heading_border_lr_color=None, column_labels_background_color=None, column_labels_font_size=None, column_labels_font_weight=None, column_labels_text_transform=None, column_labels_padding=None, column_labels_padding_horizontal=None, column_labels_vlines_style=None, column_labels_vlines_width=None, column_labels_vlines_color=None, column_labels_border_top_style=None, column_labels_border_top_width=None, column_labels_border_top_color=None, column_labels_border_bottom_style=None, column_labels_border_bottom_width=None, column_labels_border_bottom_color=None, column_labels_border_lr_style=None, column_labels_border_lr_width=None, column_labels_border_lr_color=None, column_labels_hidden=None, row_group_background_color=None, row_group_font_size=None, row_group_font_weight=None, row_group_text_transform=None, row_group_padding=None, row_group_padding_horizontal=None, row_group_border_top_style=None, row_group_border_top_width=None, row_group_border_top_color=None, row_group_border_bottom_style=None, row_group_border_bottom_width=None, row_group_border_bottom_color=None, row_group_border_left_style=None, row_group_border_left_width=None, row_group_border_left_color=None, row_group_border_right_style=None, row_group_border_right_width=None, row_group_border_right_color=None, row_group_as_column=None, table_body_hlines_style=None, table_body_hlines_width=None, table_body_hlines_color=None, table_body_vlines_style=None, table_body_vlines_width=None, table_body_vlines_color=None, table_body_border_top_style=None, table_body_border_top_width=None, table_body_border_top_color=None, table_body_border_bottom_style=None, table_body_border_bottom_width=None, table_body_border_bottom_color=None, stub_background_color=None, stub_font_size=None, stub_font_weight=None, stub_text_transform=None, stub_border_style=None, stub_border_width=None, stub_border_color=None, stub_row_group_font_size=None, stub_row_group_font_weight=None, stub_row_group_text_transform=None, stub_row_group_border_style=None, stub_row_group_border_width=None, stub_row_group_border_color=None, data_row_padding=None, data_row_padding_horizontal=None, source_notes_background_color=None, source_notes_font_size=None, source_notes_padding=None, source_notes_padding_horizontal=None, source_notes_border_bottom_style=None, source_notes_border_bottom_width=None, source_notes_border_bottom_color=None, source_notes_border_lr_style=None, source_notes_border_lr_width=None, source_notes_border_lr_color=None, source_notes_multiline=None, source_notes_sep=None, row_striping_background_color=None, row_striping_include_stub=None, row_striping_include_table_body=None)\nModify the table output options.\nModify the options available in a table. These options are named by the components, the subcomponents, and the element that can adjusted.\n\nParameters\n\n\n\n\n\n\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\ncontainer_width\nstr | None\nThe width of the table’s container. Can be specified as a single-length character with units of pixels or as a percentage. If provided as a scalar numeric value, it is assumed that the value is given in units of pixels.\nNone\n\n\ncontainer_height\nstr | None\nThe height of the table’s container.\nNone\n\n\ncontainer_overflow_x\nstr | None\nAn option to enable scrolling in the horizontal direction when the table content overflows the container dimensions. Using True (the default) means that horizontal scrolling is enabled to view the entire table in those directions. With False, the table may be clipped if the table width or height exceeds the container_width.\nNone\n\n\ncontainer_overflow_y\nstr | None\nAn option to enable scrolling in the vertical direction when the table content overflows. Same rules apply as for container_overflow_x; the dependency here is that of the table height (container_height).\nNone\n\n\ntable_width\nstr | None\nThe width of the table. Can be specified as a string with units of pixels or as a percentage. If provided as a numeric value, it is assumed that the value is given in units of pixels.\nNone\n\n\ntable_layout\nstr | None\nThe value for the table-layout CSS style in the HTML output context. By default, this is \"fixed\" but another valid option is \"auto\".\nNone\n\n\ntable_margin_left\nstr | None\nThe size of the margins on the left of the table within the container. Can be specified as a single-length value with units of pixels or as a percentage. If provided as a numeric value, it is assumed that the value is given in units of pixels. Using table_margin_left will overwrite any values set by table_align.\nNone\n\n\ntable_margin_right\nstr | None\nThe size of the margins on the right of the table within the container. Same rules apply as for table_margin_left. Using table_margin_right will overwrite any values set by table_align.\nNone\n\n\ntable_background_color\nstr | None\nThe background color for the table. A color name or a hexadecimal color code should be provided.\nNone\n\n\ntable_additional_css\nlist[str] | None\nAdditional CSS that can be added to the table. This can be used to add any custom CSS that is not covered by the other options.\nNone\n\n\ntable_font_names\nstr | list[str] | None\nThe names of the fonts used for the table. This should be provided as a list of font names. If the first font isn’t available, then the next font is tried (and so on).\nNone\n\n\ntable_font_size\nstr | None\nThe font size for the table. Can be specified as a string with units of pixels or as a percentage. If provided as a numeric value, it is assumed that the value is given in units of pixels.\nNone\n\n\ntable_font_weight\nstr | int | float | None\nThe font weight of the table. Can be a text-based keyword such as \"normal\", \"bold\", \"lighter\", \"bolder\", or, a numeric value between 1 and 1000, inclusive. Note that only variable fonts may support the numeric mapping of weight.\nNone\n\n\ntable_font_style\nstr | None\nThe font style for the table. Can be one of either \"normal\", \"italic\", or \"oblique\".\nNone\n\n\ntable_font_color\nstr | None\nThe text color used throughout the table. A color name or a hexadecimal color code should be provided.\nNone\n\n\ntable_font_color_light\nstr | None\nThe text color used throughout the table when the background color is dark. A color name or a hexadecimal color code should be provided.\nNone\n\n\ntable_border_top_style\nstr | None\nThe style of the table’s absolute top border. Can be one of either \"solid\", \"dotted\", \"dashed\", \"double\", \"groove\", \"ridge\", \"inset\", or \"outset\".\nNone\n\n\ntable_border_top_width\nstr | None\nThe width of the table’s absolute top border. Can be specified as a string with units of pixels or as a percentage. If provided as a numeric value, it is assumed that the value is given in units of pixels.\nNone\n\n\ntable_border_top_color\nstr | None\nThe color of the table’s absolute top border. A color name or a hexadecimal color code should be provided.\nNone\n\n\ntable_border_bottom_style\nstr | None\nThe style of the table’s absolute bottom border.\nNone\n\n\ntable_border_bottom_width\nstr | None\nThe width of the table’s absolute bottom border.\nNone\n\n\ntable_border_bottom_color\nstr | None\nThe color of the table’s absolute bottom border.\nNone\n\n\ntable_border_left_style\nstr | None\nThe style of the table’s absolute left border.\nNone\n\n\ntable_border_left_width\nstr | None\nThe width of the table’s absolute left border.\nNone\n\n\ntable_border_left_color\nstr | None\nThe color of the table’s absolute left border.\nNone\n\n\ntable_border_right_style\nstr | None\nThe style of the table’s absolute right border.\nNone\n\n\ntable_border_right_width\nstr | None\nThe width of the table’s absolute right border.\nNone\n\n\ntable_border_right_color\nstr | None\nThe color of the table’s absolute right border.\nNone\n\n\nheading_background_color\nstr | None\nThe background color for the heading. A color name or a hexadecimal color code should be provided.\nNone\n\n\nheading_align\nstr | None\nControls the horizontal alignment of the heading title and subtitle. We can either use \"center\", \"left\", or \"right\".\nNone\n\n\nheading_title_font_size\nstr | None\nThe font size for the heading title element.\nNone\n\n\nheading_title_font_weight\nstr | int | float | None\nThe font weight of the heading title.\nNone\n\n\nheading_subtitle_font_size\nstr | None\nThe font size for the heading subtitle element.\nNone\n\n\nheading_subtitle_font_weight\nstr | int | float | None\nThe font weight of the heading subtitle.\nNone\n\n\nheading_padding\nstr | None\nThe amount of vertical padding to incorporate in the heading (title and subtitle). Can be specified as a string with units of pixels or as a percentage. If provided as a numeric value, it is assumed that the value is given in units of pixels.\nNone\n\n\nheading_padding_horizontal\nstr | None\nThe amount of horizontal padding to incorporate in the heading (title and subtitle). Can be specified as a string with units of pixels or as a percentage. If provided as a numeric value, it is assumed that the value is given in units of pixels.\nNone\n\n\nheading_border_bottom_style\nstr | None\nThe style of the header’s bottom border.\nNone\n\n\nheading_border_bottom_width\nstr | None\nThe width of the header’s bottom border. If the width of this border is larger, then it will be the visible border.\nNone\n\n\nheading_border_bottom_color\nstr | None\nThe color of the header’s bottom border.\nNone\n\n\nheading_border_lr_style\nstr | None\nThe style of the left and right borders of the heading location.\nNone\n\n\nheading_border_lr_width\nstr | None\nThe width of the left and right borders of the heading location. If the width of this border is larger, then it will be the visible border.\nNone\n\n\nheading_border_lr_color\nstr | None\nThe color of the left and right borders of the heading location.\nNone\n\n\ncolumn_labels_background_color\nstr | None\nThe background color for the column labels. A color name or a hexadecimal color code should be provided.\nNone\n\n\ncolumn_labels_font_size\nstr | None\nThe font size to use for all column labels.\nNone\n\n\ncolumn_labels_font_weight\nstr | int | float | None\nThe font weight of the table’s column labels.\nNone\n\n\ncolumn_labels_text_transform\nstr | None\nThe text transformation for the column labels. Either of the \"uppercase\", \"lowercase\", or \"capitalize\" keywords can be used.\nNone\n\n\ncolumn_labels_padding\nstr | None\nThe amount of vertical padding to incorporate in the column_labels (this includes the column spanners).\nNone\n\n\ncolumn_labels_padding_horizontal\nstr | None\nThe amount of horizontal padding to incorporate in the column_labels (this includes the column spanners).\nNone\n\n\ncolumn_labels_vlines_style\nstr | None\nThe style of all vertical lines (‘vlines’) of the column_labels.\nNone\n\n\ncolumn_labels_vlines_width\nstr | None\nThe width of all vertical lines (‘vlines’) of the column_labels.\nNone\n\n\ncolumn_labels_vlines_color\nstr | None\nThe color of all vertical lines (‘vlines’) of the column_labels.\nNone\n\n\ncolumn_labels_border_top_style\nstr | None\nThe style of the top border of the column_labels location.\nNone\n\n\ncolumn_labels_border_top_width\nstr | None\nThe width of the top border of the column_labels location. If the width of this border is larger, then it will be the visible border.\nNone\n\n\ncolumn_labels_border_top_color\nstr | None\nThe color of the top border of the column_labels location.\nNone\n\n\ncolumn_labels_border_bottom_style\nstr | None\nThe style of the bottom border of the column_labels location.\nNone\n\n\ncolumn_labels_border_bottom_width\nstr | None\nThe width of the bottom border of the column_labels location. If the width of this border is larger, then it will be the visible border.\nNone\n\n\ncolumn_labels_border_bottom_color\nstr | None\nThe color of the bottom border of the column_labels location.\nNone\n\n\ncolumn_labels_border_lr_style\nstr | None\nThe style of the left and right borders of the column_labels location.\nNone\n\n\ncolumn_labels_border_lr_width\nstr | None\nThe width of the left and right borders of the column_labels location. If the width of this border is larger, then it will be the visible border.\nNone\n\n\ncolumn_labels_border_lr_color\nstr | None\nThe color of the left and right borders of the column_labels location.\nNone\n\n\ncolumn_labels_hidden\nbool | None\nAn option to hide the column labels. If providing True then the entire column_labels location won’t be seen and the table header (if present) will collapse downward.\nNone\n\n\nrow_group_background_color\nstr | None\nThe background color for the row group labels. A color name or a hexadecimal color code should be provided.\nNone\n\n\nrow_group_font_weight\nstr | int | float | None\nThe font weight for all row group labels present in the table.\nNone\n\n\nrow_group_font_size\nstr | None\nThe font size to use for all row group labels.\nNone\n\n\nrow_group_padding\nstr | None\nThe amount of vertical padding to incorporate in the row group labels.\nNone\n\n\nrow_group_border_top_style\nstr | None\nThe style of the top border of the row_group location.\nNone\n\n\nrow_group_border_top_width\nstr | None\nThe width of the top border of the row_group location. If the width of this border is larger, then it will be the visible border.\nNone\n\n\nrow_group_border_top_color\nstr | None\nThe color of the top border of the row_group location.\nNone\n\n\nrow_group_border_bottom_style\nstr | None\nThe style of the bottom border of the row_group location.\nNone\n\n\nrow_group_border_bottom_width\nstr | None\nThe width of the bottom border of the row_group location. If the width of this border is larger, then it will be the visible border.\nNone\n\n\nrow_group_border_bottom_color\nstr | None\nThe color of the bottom border of the row_group location.\nNone\n\n\nrow_group_border_left_style\nstr | None\nThe style of the left border of the row_group location.\nNone\n\n\nrow_group_border_left_width\nstr | None\nThe width of the left border of the row_group location. If the width of this border is larger, then it will be the visible border.\nNone\n\n\nrow_group_border_left_color\nstr | None\nThe color of the left border of the row_group location.\nNone\n\n\nrow_group_border_right_style\nstr | None\nThe style of the right border of the row_group location.\nNone\n\n\nrow_group_border_right_width\nstr | None\nThe width of the right border of the row_group location. If the width of this border is\nNone\n\n\nrow_group_border_right_color\nstr | None\nThe color of the right border of the row_group location.\nNone\n\n\nrow_group_as_column\nbool | None\nAn option to render the row group labels as a column. If True, then the row group labels will be rendered as a column to the left of the table body. If False, then the row group labels will be rendered as a separate row above the grouping of rows.\nNone\n\n\ntable_body_hlines_style\nstr | None\nThe style of all horizontal lines (‘hlines’) in the table_body.\nNone\n\n\ntable_body_hlines_width\nstr | None\nThe width of all horizontal lines (‘hlines’) in the table_body.\nNone\n\n\ntable_body_hlines_color\nstr | None\nThe color of all horizontal lines (‘hlines’) in the table_body.\nNone\n\n\ntable_body_vlines_style\nstr | None\nThe style of all vertical lines (‘vlines’) in the table_body.\nNone\n\n\ntable_body_vlines_width\nstr | None\nThe width of all vertical lines (‘vlines’) in the table_body.\nNone\n\n\ntable_body_vlines_color\nstr | None\nThe color of all vertical lines (‘vlines’) in the table_body.\nNone\n\n\ntable_body_border_top_style\nstr | None\nThe style of the top border of the table_body location.\nNone\n\n\ntable_body_border_top_width\nstr | None\nThe width of the top border of the table_body location. If the width of this border is larger, then it will be the visible border.\nNone\n\n\ntable_body_border_top_color\nstr | None\nThe color of the top border of the table_body location.\nNone\n\n\ntable_body_border_bottom_style\nstr | None\nThe style of the bottom border of the table_body location.\nNone\n\n\ntable_body_border_bottom_width\nstr | None\nThe width of the bottom border of the table_body location. If the width of this border\nNone\n\n\ntable_body_border_bottom_color\nstr | None\nThe color of the bottom border of the table_body location.\nNone\n\n\nstub_background_color\nstr | None\nThe background color for the stub. A color name or a hexadecimal color code should be provided.\nNone\n\n\nstub_font_size\nstr | None\nThe font size to use for all row labels present in the table stub.\nNone\n\n\nstub_font_weight\nstr | int | float | None\nThe font weight for all row labels present in the table stub.\nNone\n\n\nstub_text_transform\nstr | None\nThe text transformation for the row labels present in the table stub.\nNone\n\n\nstub_border_style\nstr | None\nThe style of the vertical border of the table stub.\nNone\n\n\nstub_border_width\nstr | None\nThe width of the vertical border of the table stub.\nNone\n\n\nstub_border_color\nstr | None\nThe color of the vertical border of the table stub.\nNone\n\n\nstub_row_group_font_size\nstr | None\nThe font size for the row group column in the stub.\nNone\n\n\nstub_row_group_font_weight\nstr | int | float | None\nThe font weight for the row group column in the stub.\nNone\n\n\nstub_row_group_text_transform\nstr | None\nThe text transformation for the row group column in the stub.\nNone\n\n\nstub_row_group_border_style\nstr | None\nThe style of the vertical border of the row group column in the stub.\nNone\n\n\nstub_row_group_border_width\nstr | None\nThe width of the vertical border of the row group column in the stub.\nNone\n\n\nstub_row_group_border_color\nstr | None\nThe color of the vertical border of the row group column in the stub.\nNone\n\n\ndata_row_padding\nstr | None\nThe amount of vertical padding to incorporate in the body/stub rows.\nNone\n\n\ndata_row_padding_horizontal\nstr | None\nThe amount of horizontal padding to incorporate in the body/stub rows.\nNone\n\n\nsource_notes_background_color\nstr | None\nThe background color for the source notes. A color name or a hexadecimal color code should be provided.\nNone\n\n\nsource_notes_font_size\nstr | None\nThe font size to use for all source note text.\nNone\n\n\nsource_notes_padding\nstr | None\nThe amount of vertical padding to incorporate in the source notes.\nNone\n\n\nsource_notes_padding_horizontal\nstr | None\nThe amount of horizontal padding to incorporate in the source notes.\nNone\n\n\nsource_notes_multiline\nbool | None\nAn option to either put source notes in separate lines (the default, or True) or render them as a continuous line of text with source_notes_sep providing the separator (by default \" \") between notes.\nNone\n\n\nsource_notes_sep\nstr | None\nThe separating characters between adjacent source notes when rendered as a continuous line of text (when source_notes_multiline is False). The default value is a single space character (\" \").\nNone\n\n\nsource_notes_border_bottom_style\nstr | None\nThe style of the bottom border of the source_notes location.\nNone\n\n\nsource_notes_border_bottom_width\nstr | None\nThe width of the bottom border of the source_notes location. If the width of this border is larger, then it will be the visible border.\nNone\n\n\nsource_notes_border_bottom_color\nstr | None\nThe color of the bottom border of the source_notes location.\nNone\n\n\nsource_notes_border_lr_style\nstr | None\nThe style of the left and right borders of the source_notes location.\nNone\n\n\nsource_notes_border_lr_width\nstr | None\nThe width of the left and right borders of the source_notes location. If the width of this border is larger, then it will be the visible border.\nNone\n\n\nsource_notes_border_lr_color\nstr | None\nThe color of the left and right borders of the source_notes location.\nNone\n\n\nrow_striping_background_color\nstr | None\nThe background color for striped table body rows. A color name or a hexadecimal color code should be provided.\nNone\n\n\nrow_striping_include_stub\nbool | None\nAn option for whether to include the stub when striping rows.\nNone\n\n\nrow_striping_include_table_body\nbool | None\nAn option for whether to include the table body when striping rows.\nNone\n\n\n\n\n\nReturns\n\n\n\nType\nDescription\n\n\n\n\nGT\nThe GT object is returned. This is the same object that the method is called on so that we can facilitate method chaining.\n\n\n\n\n\nExamples\nUsing select columns from the exibble dataset, let’s create a new table with a number of table components added. We can use this object going forward to demonstrate some of the features available in the tab_options() method.\n\nfrom great_tables import GT, exibble, md\n\ngt_tbl = (\n GT(\n exibble[[\"num\", \"char\", \"currency\", \"row\", \"group\"]],\n rowname_col=\"row\",\n groupname_col=\"group\"\n )\n .tab_header(\n title=md(\"Data listing from **exibble**\"),\n subtitle=md(\"`exibble` is a **Great Tables** dataset.\")\n )\n .fmt_number(columns=\"num\")\n .fmt_currency(columns=\"currency\")\n .tab_source_note(source_note=\"This is only a subset of the dataset.\")\n)\n\ngt_tbl\n\n\n\n\n\n\n \n Data listing from exibble\n \n \n exibble is a Great Tables dataset.\n \n\n \n num\n char\n currency\n\n\n\n \n grp_a\n \n \n row_1\n 0.11\n apricot\n $49.95\n \n \n row_2\n 2.22\n banana\n $17.95\n \n \n row_3\n 33.33\n coconut\n $1.39\n \n \n row_4\n 444.40\n durian\n $65,100.00\n \n \n grp_b\n \n \n row_5\n 5,550.00\n \n $1,325.81\n \n \n row_6\n \n fig\n $13.26\n \n \n row_7\n 777,000.00\n grapefruit\n \n \n \n row_8\n 8,880,000.00\n honeydew\n $0.44\n \n\n \n \n \n This is only a subset of the dataset.\n \n\n\n\n\n\n\n \n\n\nWe can modify the table width to be set as \"100%“. In effect, this spans the table to entirely fill the content width area. This is done with the table_width option.\n\ngt_tbl.tab_options(table_width=\"100%\")\n\n\n\n\n\n\n \n Data listing from exibble\n \n \n exibble is a Great Tables dataset.\n \n\n \n num\n char\n currency\n\n\n\n \n grp_a\n \n \n row_1\n 0.11\n apricot\n $49.95\n \n \n row_2\n 2.22\n banana\n $17.95\n \n \n row_3\n 33.33\n coconut\n $1.39\n \n \n row_4\n 444.40\n durian\n $65,100.00\n \n \n grp_b\n \n \n row_5\n 5,550.00\n \n $1,325.81\n \n \n row_6\n \n fig\n $13.26\n \n \n row_7\n 777,000.00\n grapefruit\n \n \n \n row_8\n 8,880,000.00\n honeydew\n $0.44\n \n\n \n \n \n This is only a subset of the dataset.\n \n\n\n\n\n\n\n \n\n\nWith the table_background_color option, we can modify the table’s background color. Here, we want that to be \"lightcyan\".\n\ngt_tbl.tab_options(table_background_color=\"lightcyan\")\n\n\n\n\n\n\n \n Data listing from exibble\n \n \n exibble is a Great Tables dataset.\n \n\n \n num\n char\n currency\n\n\n\n \n grp_a\n \n \n row_1\n 0.11\n apricot\n $49.95\n \n \n row_2\n 2.22\n banana\n $17.95\n \n \n row_3\n 33.33\n coconut\n $1.39\n \n \n row_4\n 444.40\n durian\n $65,100.00\n \n \n grp_b\n \n \n row_5\n 5,550.00\n \n $1,325.81\n \n \n row_6\n \n fig\n $13.26\n \n \n row_7\n 777,000.00\n grapefruit\n \n \n \n row_8\n 8,880,000.00\n honeydew\n $0.44\n \n\n \n \n \n This is only a subset of the dataset.\n \n\n\n\n\n\n\n \n\n\nThe data rows of a table typically take up the most physical space but we have some control over the extent of that. With the data_row_padding option, it’s possible to modify the top and bottom padding of data rows. We’ll do just that in the following example, reducing the padding to a value of \"3px\".\n\ngt_tbl.tab_options(data_row_padding=\"3px\")\n\n\n\n\n\n\n \n Data listing from exibble\n \n \n exibble is a Great Tables dataset.\n \n\n \n num\n char\n currency\n\n\n\n \n grp_a\n \n \n row_1\n 0.11\n apricot\n $49.95\n \n \n row_2\n 2.22\n banana\n $17.95\n \n \n row_3\n 33.33\n coconut\n $1.39\n \n \n row_4\n 444.40\n durian\n $65,100.00\n \n \n grp_b\n \n \n row_5\n 5,550.00\n \n $1,325.81\n \n \n row_6\n \n fig\n $13.26\n \n \n row_7\n 777,000.00\n grapefruit\n \n \n \n row_8\n 8,880,000.00\n honeydew\n $0.44\n \n\n \n \n \n This is only a subset of the dataset.\n \n\n\n\n\n\n\n \n\n\nThe size of the title and the subtitle text in the header of the table can be altered with the heading_title_font_size and heading_subtitle_font_size options. Here, we’ll use the \"small\" and \"x-small\" keyword values.\n\ngt_tbl.tab_options(heading_title_font_size=\"small\", heading_subtitle_font_size=\"x-small\")\n\n\n\n\n\n\n \n Data listing from exibble\n \n \n exibble is a Great Tables dataset.\n \n\n \n num\n char\n currency\n\n\n\n \n grp_a\n \n \n row_1\n 0.11\n apricot\n $49.95\n \n \n row_2\n 2.22\n banana\n $17.95\n \n \n row_3\n 33.33\n coconut\n $1.39\n \n \n row_4\n 444.40\n durian\n $65,100.00\n \n \n grp_b\n \n \n row_5\n 5,550.00\n \n $1,325.81\n \n \n row_6\n \n fig\n $13.26\n \n \n row_7\n 777,000.00\n grapefruit\n \n \n \n row_8\n 8,880,000.00\n honeydew\n $0.44\n \n\n \n \n \n This is only a subset of the dataset.\n \n\n\n\n\n\n\n \n\n\n\n\n\ntab_source_note\nGT.tab_source_note(self, source_note)\nAdd a source note citation.\nAdd a source note to the footer part of the table. A source note is useful for citing the data included in the table. Several can be added to the footer, simply use the tab_source_note() method multiple times and they will be inserted in the order provided. We can use Markdown formatting for the note, or, if the table is intended for HTML output, we can include HTML formatting.\n\nParameters\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\nsource_note\nstr | Text\nText to be used in the source note. We can optionally use the md() or html() helper functions to style the text as Markdown or to retain HTML elements in the text.\nrequired\n\n\n\n\n\nReturns\n\n\n\nType\nDescription\n\n\n\n\nGT\nThe GT object is returned. This is the same object that the method is called on so that we can facilitate method chaining.\n\n\n\n\n\nExamples\nWith three columns from the gtcars dataset, let’s create a new table. We can use the tab_source_note() method to add a source note to the table footer. Here we are citing the data source but this method can be used for any text you’d prefer to display in the footer component of the table.\n\nfrom great_tables import GT\nfrom great_tables.data import gtcars\n\ngtcars_mini = gtcars[[\"mfr\", \"model\", \"msrp\"]].head(5)\n\n(\n GT(gtcars_mini, rowname_col=\"model\")\n .tab_source_note(source_note=\"From edmunds.com\")\n)\n\n\n\n\n\n\n\n \n mfr\n msrp\n\n\n\n \n GT\n Ford\n 447000.0\n \n \n 458 Speciale\n Ferrari\n 291744.0\n \n \n 458 Spider\n Ferrari\n 263553.0\n \n \n 458 Italia\n Ferrari\n 233509.0\n \n \n 488 GTB\n Ferrari\n 245400.0\n \n\n \n \n \n From edmunds.com\n \n\n\n\n\n\n\n \n\n\n\n\n\ntab_spanner\nGT.tab_spanner(self, label, columns=None, spanners=None, level=None, id=None, gather=True, replace=False)\nInsert a spanner above a selection of column headings.\nThis part of the table contains, at a minimum, column labels and, optionally, an unlimited number of levels for spanners. A spanner will occupy space over any number of contiguous column labels and it will have an associated label and ID value. This method allows for mapping to be defined by column names, existing spanner ID values, or a mixture of both.\nThe spanners are placed in the order of calling tab_spanner() so if a later call uses the same columns in its definition (or even a subset) as the first invocation, the second spanner will be overlaid atop the first. Options exist for forcibly inserting a spanner underneath others (with level as space permits) and with replace, which allows for full or partial spanner replacement.\n\nParameters\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\nlabel\nstr | Text\nThe text to use for the spanner label. We can optionally use the md() and html() helper functions to style the text as Markdown or to retain HTML elements in the text. Alternatively, units notation can be used (see define_units() for details).\nrequired\n\n\ncolumns\nSelectExpr\nThe columns to target. Can either be a single column name or a series of column names provided in a list.\nNone\n\n\nspanners\nstr | list[str] | None\nThe spanners that should be spanned over, should they already be defined. One or more spanner ID values (in quotes) can be supplied here. This argument works in tandem with the columns argument.\nNone\n\n\nlevel\nint | None\nAn explicit level to which the spanner should be placed. If not provided, Great Tables will choose the level based on the inputs provided within columns and spanners, placing the spanner label where it will fit. The first spanner level (right above the column labels) is 0.\nNone\n\n\nid\nstr | None\nThe ID for the spanner. When accessing a spanner through the spanners argument of tab_spanner() the id value is used as the reference (and not the label). If an id is not explicitly provided here, it will be taken from the label value. It is advisable to set an explicit id value if you plan to access this cell in a later call and the label text is complicated (e.g., contains markup, is lengthy, or both). Finally, when providing an id value you must ensure that it is unique across all ID values set for spanner labels (the method will throw an error if id isn’t unique).\nNone\n\n\ngather\nbool\nAn option to move the specified columns such that they are unified under the spanner. Ordering of the moved-into-place columns will be preserved in all cases. By default, this is set to True.\nTrue\n\n\nreplace\nbool\nShould new spanners be allowed to partially or fully replace existing spanners? (This is a possibility if setting spanners at an already populated level.) By default, this is set to False and an error will occur if some replacement is attempted.\nFalse\n\n\n\n\n\nReturns\n\n\n\nType\nDescription\n\n\n\n\nGT\nThe GT object is returned. This is the same object that the method is called on so that we can facilitate method chaining.\n\n\n\n\n\nExamples\nLet’s create a table using a small portion of the gtcars dataset. Over several columns (hp, hp_rpm, trq, trq_rpm, mpg_c, mpg_h) we’ll use tab_spanner() to add a spanner with the label \"performance\". This effectively groups together several columns related to car performance under a unifying label.\n\nfrom great_tables import GT\nfrom great_tables.data import gtcars\n\ncolnames = [\"model\", \"hp\", \"hp_rpm\", \"trq\", \"trq_rpm\", \"mpg_c\", \"mpg_h\"]\ngtcars_mini = gtcars[colnames].head(10)\n\n(\n GT(gtcars_mini)\n .tab_spanner(\n label=\"performance\",\n columns=[\"hp\", \"hp_rpm\", \"trq\", \"trq_rpm\", \"mpg_c\", \"mpg_h\"]\n )\n)\n\n\n\n\n\n\n\n model\n \n performance\n \n\n\n hp\n hp_rpm\n trq\n trq_rpm\n mpg_c\n mpg_h\n\n\n\n \n GT\n 647.0\n 6250.0\n 550.0\n 5900.0\n 11.0\n 18.0\n \n \n 458 Speciale\n 597.0\n 9000.0\n 398.0\n 6000.0\n 13.0\n 17.0\n \n \n 458 Spider\n 562.0\n 9000.0\n 398.0\n 6000.0\n 13.0\n 17.0\n \n \n 458 Italia\n 562.0\n 9000.0\n 398.0\n 6000.0\n 13.0\n 17.0\n \n \n 488 GTB\n 661.0\n 8000.0\n 561.0\n 3000.0\n 15.0\n 22.0\n \n \n California\n 553.0\n 7500.0\n 557.0\n 4750.0\n 16.0\n 23.0\n \n \n GTC4Lusso\n 680.0\n 8250.0\n 514.0\n 5750.0\n 12.0\n 17.0\n \n \n FF\n 652.0\n 8000.0\n 504.0\n 6000.0\n 11.0\n 16.0\n \n \n F12Berlinetta\n 731.0\n 8250.0\n 509.0\n 6000.0\n 11.0\n 16.0\n \n \n LaFerrari\n 949.0\n 9000.0\n 664.0\n 6750.0\n 12.0\n 16.0\n \n\n\n\n\n\n\n \n\n\nWe can also use Markdown formatting for the spanner label. In this example, we’ll use gt.md(\"*Performance*\") to make the label italicized.\n\nfrom great_tables import GT, md\nfrom great_tables.data import gtcars\n\ncolnames = [\"model\", \"hp\", \"hp_rpm\", \"trq\", \"trq_rpm\", \"mpg_c\", \"mpg_h\"]\ngtcars_mini = gtcars[colnames].head(10)\n\n(\n GT(gtcars_mini)\n .tab_spanner(\n label=md(\"*Performance*\"),\n columns=[\"hp\", \"hp_rpm\", \"trq\", \"trq_rpm\", \"mpg_c\", \"mpg_h\"]\n )\n)\n\n\n\n\n\n\n\n model\n \n Performance\n \n\n\n hp\n hp_rpm\n trq\n trq_rpm\n mpg_c\n mpg_h\n\n\n\n \n GT\n 647.0\n 6250.0\n 550.0\n 5900.0\n 11.0\n 18.0\n \n \n 458 Speciale\n 597.0\n 9000.0\n 398.0\n 6000.0\n 13.0\n 17.0\n \n \n 458 Spider\n 562.0\n 9000.0\n 398.0\n 6000.0\n 13.0\n 17.0\n \n \n 458 Italia\n 562.0\n 9000.0\n 398.0\n 6000.0\n 13.0\n 17.0\n \n \n 488 GTB\n 661.0\n 8000.0\n 561.0\n 3000.0\n 15.0\n 22.0\n \n \n California\n 553.0\n 7500.0\n 557.0\n 4750.0\n 16.0\n 23.0\n \n \n GTC4Lusso\n 680.0\n 8250.0\n 514.0\n 5750.0\n 12.0\n 17.0\n \n \n FF\n 652.0\n 8000.0\n 504.0\n 6000.0\n 11.0\n 16.0\n \n \n F12Berlinetta\n 731.0\n 8250.0\n 509.0\n 6000.0\n 11.0\n 16.0\n \n \n LaFerrari\n 949.0\n 9000.0\n 664.0\n 6750.0\n 12.0\n 16.0\n \n\n\n\n\n\n\n \n\n\n\n\n\ntab_stub\nGT.tab_stub(self, rowname_col=None, groupname_col=None)\nAdd a table stub, to emphasize row and group information.\n\nParameters\n\n\n\n\n\n\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\nrowname_col\nstr | None\nThe column to use for row names. By default, no row names added.\nNone\n\n\ngroupname_col\nstr | None\nThe column to use for group names. By default no group names added.\nNone\n\n\n\n\n\nExamples\nBy default, all data is together in the body of the table.\n\nfrom great_tables import GT, exibble\n\nGT(exibble)\n\n\n\n\n\n\n\n num\n char\n fctr\n date\n time\n datetime\n currency\n row\n group\n\n\n\n \n 0.1111\n apricot\n one\n 2015-01-15\n 13:35\n 2018-01-01 02:22\n 49.95\n row_1\n grp_a\n \n \n 2.222\n banana\n two\n 2015-02-15\n 14:40\n 2018-02-02 14:33\n 17.95\n row_2\n grp_a\n \n \n 33.33\n coconut\n three\n 2015-03-15\n 15:45\n 2018-03-03 03:44\n 1.39\n row_3\n grp_a\n \n \n 444.4\n durian\n four\n 2015-04-15\n 16:50\n 2018-04-04 15:55\n 65100.0\n row_4\n grp_a\n \n \n 5550.0\n \n five\n 2015-05-15\n 17:55\n 2018-05-05 04:00\n 1325.81\n row_5\n grp_b\n \n \n \n fig\n six\n 2015-06-15\n \n 2018-06-06 16:11\n 13.255\n row_6\n grp_b\n \n \n 777000.0\n grapefruit\n seven\n \n 19:10\n 2018-07-07 05:22\n \n row_7\n grp_b\n \n \n 8880000.0\n honeydew\n eight\n 2015-08-15\n 20:20\n \n 0.44\n row_8\n grp_b\n \n\n\n\n\n\n\n \n\n\nThe table stub separates row names with a vertical line, and puts group names on their own line.\n\nGT(exibble).tab_stub(rowname_col=\"row\", groupname_col=\"group\")\n\n\n\n\n\n\n\n \n num\n char\n fctr\n date\n time\n datetime\n currency\n\n\n\n \n grp_a\n \n \n row_1\n 0.1111\n apricot\n one\n 2015-01-15\n 13:35\n 2018-01-01 02:22\n 49.95\n \n \n row_2\n 2.222\n banana\n two\n 2015-02-15\n 14:40\n 2018-02-02 14:33\n 17.95\n \n \n row_3\n 33.33\n coconut\n three\n 2015-03-15\n 15:45\n 2018-03-03 03:44\n 1.39\n \n \n row_4\n 444.4\n durian\n four\n 2015-04-15\n 16:50\n 2018-04-04 15:55\n 65100.0\n \n \n grp_b\n \n \n row_5\n 5550.0\n \n five\n 2015-05-15\n 17:55\n 2018-05-05 04:00\n 1325.81\n \n \n row_6\n \n fig\n six\n 2015-06-15\n \n 2018-06-06 16:11\n 13.255\n \n \n row_7\n 777000.0\n grapefruit\n seven\n \n 19:10\n 2018-07-07 05:22\n \n \n \n row_8\n 8880000.0\n honeydew\n eight\n 2015-08-15\n 20:20\n \n 0.44\n \n\n\n\n\n\n\n \n\n\n\n\n\ntab_stubhead\nGT.tab_stubhead(self, label)\nAdd label text to the stubhead.\nAdd a label to the stubhead of a table. The stubhead is the lone element that is positioned left of the column labels, and above the stub. If a stub does not exist, then there is no stubhead (so no change will be made when using this method in that case). We have the flexibility to use Markdown formatting for the stubhead label (through use of the md() helper function). Furthermore, we can use HTML for the stubhead label so long as we also use the html() helper function.\n\nParameters\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\nlabel\nstr | Text\nThe text to be used as the stubhead label. We can optionally use the md() and html() helper functions to style the text as Markdown or to retain HTML elements in the text.\nrequired\n\n\n\n\n\nReturns\n\n\n\nType\nDescription\n\n\n\n\nGT\nThe GT object is returned. This is the same object that the method is called on so that we can facilitate method chaining.\n\n\n\n\n\nExamples\nUsing a small subset of the gtcars dataset, we can create a table with row labels. Since we have row labels in the stub (via use of rowname_col=\"model\" in the GT() call) we have a stubhead, so, let’s add a stubhead label (\"car\") with the tab_stubhead() method to describe what’s in the stub.\n\nfrom great_tables import GT\nfrom great_tables.data import gtcars\n\ngtcars_mini = gtcars[[\"model\", \"year\", \"hp\", \"trq\"]].head(5)\n\n(\n GT(gtcars_mini, rowname_col=\"model\")\n .tab_stubhead(label=\"car\")\n)\n\n\n\n\n\n\n\n car\n year\n hp\n trq\n\n\n\n \n GT\n 2017.0\n 647.0\n 550.0\n \n \n 458 Speciale\n 2015.0\n 597.0\n 398.0\n \n \n 458 Spider\n 2015.0\n 562.0\n 398.0\n \n \n 458 Italia\n 2014.0\n 562.0\n 398.0\n \n \n 488 GTB\n 2016.0\n 661.0\n 561.0\n \n\n\n\n\n\n\n \n\n\nWe can also use Markdown formatting for the stubhead label. In this example, we’ll use md(\"*Car*\") to make the label italicized.\n\nfrom great_tables import GT, md\nfrom great_tables.data import gtcars\n\n(\n GT(gtcars_mini, rowname_col=\"model\")\n .tab_stubhead(label=md(\"*Car*\"))\n)\n\n\n\n\n\n\n\n Car\n year\n hp\n trq\n\n\n\n \n GT\n 2017.0\n 647.0\n 550.0\n \n \n 458 Speciale\n 2015.0\n 597.0\n 398.0\n \n \n 458 Spider\n 2015.0\n 562.0\n 398.0\n \n \n 458 Italia\n 2014.0\n 562.0\n 398.0\n \n \n 488 GTB\n 2016.0\n 661.0\n 561.0\n \n\n\n\n\n\n\n \n\n\n\n\n\ntab_style\nGT.tab_style(self, style, locations)\nAdd custom style to one or more cells\nWith the tab_style() method we can target specific cells and apply styles to them. We do this with the combination of the style and location arguments. The style argument requires use of styling classes (e.g., style.fill(color=\"red\")) and the location argument needs to be an expression of the cells we want to target using location targeting classes (e.g., loc.body(columns=<column_name>)). With the available suite of styling classes, here are some of the styles we can apply:\n\nthe background color of the cell (style.fill()’s color)\nthe cell’s text color, font, and size (style.text()’s color, font, and size)\nthe text style (style.text()’s style), enabling the use of italics or oblique text.\nthe text weight (style.text()’s weight), allowing the use of thin to bold text (the degree of choice is greater with variable fonts)\nthe alignment of text (style.text()’s align)\ncell borders with the style.borders() class\n\n\nParameters\n\n\n\n\n\n\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\nstyle\nCellStyle | list[CellStyle]\nThe styles to use for the cells at the targeted locations. The style.text(), style.fill(), and style.borders() classes can be used here to more easily generate valid styles.\nrequired\n\n\nlocations\nLoc | list[Loc]\nThe cell or set of cells to be associated with the style. The loc.body() class can be used here to easily target body cell locations.\nrequired\n\n\n\n\n\nReturns\n\n\n\nType\nDescription\n\n\n\n\nGT\nThe GT object is returned. This is the same object that the method is called on so that we can facilitate method chaining.\n\n\n\n\n\nExamples\nLet’s use a small subset of the exibble dataset to demonstrate how to use tab_style() to target specific cells and apply styles to them. We’ll start by creating the exibble_sm table (a subset of the exibble table) and then use tab_style() to apply a light cyan background color to the cells in the num column for the first two rows of the table. We’ll then apply a larger font size to the cells in the fctr column for the last four rows of the table.\n\nfrom great_tables import GT, style, loc, exibble\n\nexibble_sm = exibble[[\"num\", \"fctr\", \"row\", \"group\"]]\n\n(\n GT(exibble_sm, rowname_col=\"row\", groupname_col=\"group\")\n .tab_style(\n style=style.fill(color=\"lightcyan\"),\n locations=loc.body(columns=\"num\", rows=[\"row_1\", \"row_2\"]),\n )\n .tab_style(\n style=style.text(size=\"22px\"),\n locations=loc.body(columns=[\"fctr\"], rows=[4, 5, 6, 7]),\n )\n)\n\n\n\n\n\n\n\n \n num\n fctr\n\n\n\n \n grp_a\n \n \n row_1\n 0.1111\n one\n \n \n row_2\n 2.222\n two\n \n \n row_3\n 33.33\n three\n \n \n row_4\n 444.4\n four\n \n \n grp_b\n \n \n row_5\n 5550.0\n five\n \n \n row_6\n \n six\n \n \n row_7\n 777000.0\n seven\n \n \n row_8\n 8880000.0\n eight\n \n\n\n\n\n\n\n \n\n\nLet’s use exibble once again to create a simple, two-column output table (keeping only the num and currency columns). With the tab_style() method (called thrice), we’ll add style to the values already formatted by fmt_number() and fmt_currency(). In the style argument of the first two tab_style() call, we can define multiple types of styling with the style.fill() and style.text() classes (enclosing these in a list). The cells to be targeted for styling require the use of loc.body(), which is used here with different columns being targeted. For the final tab_style() call, we demonstrate the use of style.borders() class as the style argument, which is employed in conjunction with loc.body() to locate the row to be styled.\n\nfrom great_tables import GT, style, loc, exibble\n\n(\n GT(exibble[[\"num\", \"currency\"]])\n .fmt_number(columns=\"num\", decimals=1)\n .fmt_currency(columns=\"currency\")\n .tab_style(\n style=[\n style.fill(color=\"lightcyan\"),\n style.text(weight=\"bold\")\n ],\n locations=loc.body(columns=\"num\")\n )\n .tab_style(\n style=[\n style.fill(color=\"#F9E3D6\"),\n style.text(style=\"italic\")\n ],\n locations=loc.body(columns=\"currency\")\n )\n .tab_style(\n style=style.borders(sides=[\"top\", \"bottom\"], weight='2px', color=\"red\"),\n locations=loc.body(rows=[4])\n )\n)\n\n\n\n\n\n\n\n num\n currency\n\n\n\n \n 0.1\n $49.95\n \n \n 2.2\n $17.95\n \n \n 33.3\n $1.39\n \n \n 444.4\n $65,100.00\n \n \n 5,550.0\n $1,325.81\n \n \n \n $13.26\n \n \n 777,000.0\n \n \n \n 8,880,000.0\n $0.44\n \n\n\n\n\n\n\n \n\n\n\n\n\nwith_id\nGT.with_id(self, id=None)\nSet the id for this table.\nNote that this is a shortcut for the table_id= argument in GT.tab_options().\n\n\nwith_locale\nGT.with_locale(self, locale=None)\nSet a column to be the default locale.\nSetting a default locale affects formatters like .fmt_number, and .fmt_date, by having them default to locale-specific features (e.g. representing one thousand as 1.000,00)" + "text": "Methods\n\n\n\nName\nDescription\n\n\n\n\nas_raw_html\nGet the HTML content of a GT object.\n\n\ncols_align\nSet the alignment of one or more columns.\n\n\ncols_hide\nHide one or more columns.\n\n\ncols_label\nRelabel one or more columns.\n\n\ncols_move\nMove one or more columns.\n\n\ncols_move_to_end\nMove one or more columns to the end.\n\n\ncols_move_to_start\nMove one or more columns to the start.\n\n\ncols_width\nSet the widths of columns.\n\n\ndata_color\nPerform data cell colorization.\n\n\nfmt\nSet a column format with a formatter function.\n\n\nfmt_bytes\nFormat values as bytes.\n\n\nfmt_currency\nFormat values as currencies.\n\n\nfmt_date\nFormat values as dates.\n\n\nfmt_datetime\nFormat values as datetimes.\n\n\nfmt_image\nFormat image paths to generate images in cells.\n\n\nfmt_integer\nFormat values as integers.\n\n\nfmt_markdown\nFormat Markdown text.\n\n\nfmt_nanoplot\nFormat data for nanoplot visualizations.\n\n\nfmt_number\nFormat numeric values.\n\n\nfmt_percent\nFormat values as a percentage.\n\n\nfmt_roman\nFormat values as Roman numerals.\n\n\nfmt_scientific\nFormat values to scientific notation.\n\n\nfmt_time\nFormat values as times.\n\n\nfmt_units\nFormat measurement units.\n\n\nopt_align_table_header\nOption to align the table header.\n\n\nopt_all_caps\nOption to use all caps in select table locations.\n\n\nopt_footnote_marks\nOption to modify the set of footnote marks\n\n\nopt_horizontal_padding\nOption to scale the horizontal padding of the table.\n\n\nopt_row_striping\nOption to add or remove row striping.\n\n\nopt_stylize\nStylize your table with a colorful look.\n\n\nopt_table_font\nOptions to define font choices for the entire table.\n\n\nopt_table_outline\nOption to wrap an outline around the entire table.\n\n\nopt_vertical_padding\nOption to scale the vertical padding of the table.\n\n\nsave\nProduce a high-resolution image file or PDF of the table.\n\n\nshow\nDisplay the table in a notebook or a web browser.\n\n\nsub_missing\nSubstitute missing values in the table body.\n\n\nsub_zero\nSubstitute zero values in the table body.\n\n\ntab_header\nAdd a table header.\n\n\ntab_options\nModify the table output options.\n\n\ntab_source_note\nAdd a source note citation.\n\n\ntab_spanner\nInsert a spanner above a selection of column headings.\n\n\ntab_stub\nAdd a table stub, to emphasize row and group information.\n\n\ntab_stubhead\nAdd label text to the stubhead.\n\n\ntab_style\nAdd custom style to one or more cells\n\n\nwith_id\nSet the id for this table.\n\n\nwith_locale\nSet a column to be the default locale.\n\n\n\n\nas_raw_html\nGT.as_raw_html(self, make_page=False, all_important=False)\nGet the HTML content of a GT object.\nGet the HTML content from a GT object as a string. This function is useful for obtaining the HTML content of a GT object for use in other contexts.\n\nParameters\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\ngt\n\nA GT object.\nrequired\n\n\n\n\n\nReturns\n\n\n\nType\nDescription\n\n\n\n\nstr\nAn HTML fragment containing a table.\n\n\n\n\n\nExamples:\nLet’s use the row column of exibble dataset to create a table. With the as_raw_html() method, we’re able to output the HTML content.\n\nfrom great_tables import GT, exibble\n\nGT(exibble[[\"row\"]]).as_raw_html()\n\n'<div id=\"aoeigwejsu\" style=\"padding-left:0px;padding-right:0px;padding-top:10px;padding-bottom:10px;overflow-x:auto;overflow-y:auto;width:auto;height:auto;\">\\n<style>\\n#aoeigwejsu table {\\n font-family: -apple-system, BlinkMacSystemFont, \\'Segoe UI\\', Roboto, Oxygen, Ubuntu, Cantarell, \\'Helvetica Neue\\', \\'Fira Sans\\', \\'Droid Sans\\', Arial, sans-serif;\\n -webkit-font-smoothing: antialiased;\\n -moz-osx-font-smoothing: grayscale;\\n }\\n\\n#aoeigwejsu thead, tbody, tfoot, tr, td, th { border-style: none; }\\n tr { background-color: transparent; }\\n#aoeigwejsu p { margin: 0; padding: 0; }\\n #aoeigwejsu .gt_table { display: table; border-collapse: collapse; line-height: normal; margin-left: auto; margin-right: auto; color: #333333; font-size: 16px; font-weight: normal; font-style: normal; background-color: #FFFFFF; width: auto; border-top-style: solid; border-top-width: 2px; border-top-color: #A8A8A8; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #A8A8A8; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; }\\n #aoeigwejsu .gt_caption { padding-top: 4px; padding-bottom: 4px; }\\n #aoeigwejsu .gt_title { color: #333333; font-size: 125%; font-weight: initial; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; border-bottom-color: #FFFFFF; border-bottom-width: 0; }\\n #aoeigwejsu .gt_subtitle { color: #333333; font-size: 85%; font-weight: initial; padding-top: 3px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; border-top-color: #FFFFFF; border-top-width: 0; }\\n #aoeigwejsu .gt_heading { background-color: #FFFFFF; text-align: center; border-bottom-color: #FFFFFF; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; }\\n #aoeigwejsu .gt_bottom_border { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }\\n #aoeigwejsu .gt_col_headings { border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; }\\n #aoeigwejsu .gt_col_heading { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: normal; text-transform: inherit; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: bottom; padding-top: 5px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; overflow-x: hidden; }\\n #aoeigwejsu .gt_column_spanner_outer { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: normal; text-transform: inherit; padding-top: 0; padding-bottom: 0; padding-left: 4px; padding-right: 4px; }\\n #aoeigwejsu .gt_column_spanner_outer:first-child { padding-left: 0; }\\n #aoeigwejsu .gt_column_spanner_outer:last-child { padding-right: 0; }\\n #aoeigwejsu .gt_column_spanner { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; vertical-align: bottom; padding-top: 5px; padding-bottom: 5px; overflow-x: hidden; display: inline-block; width: 100%; }\\n #aoeigwejsu .gt_spanner_row { border-bottom-style: hidden; }\\n #aoeigwejsu .gt_group_heading { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: middle; text-align: left; }\\n #aoeigwejsu .gt_empty_group_heading { padding: 0.5px; color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; vertical-align: middle; }\\n #aoeigwejsu .gt_from_md> :first-child { margin-top: 0; }\\n #aoeigwejsu .gt_from_md> :last-child { margin-bottom: 0; }\\n #aoeigwejsu .gt_row { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; margin: 10px; border-top-style: solid; border-top-width: 1px; border-top-color: #D3D3D3; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: middle; overflow-x: hidden; }\\n #aoeigwejsu .gt_stub { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-right-style: solid; border-right-width: 2px; border-right-color: #D3D3D3; padding-left: 5px; padding-right: 5px; }\\n #aoeigwejsu .gt_stub_row_group { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-right-style: solid; border-right-width: 2px; border-right-color: #D3D3D3; padding-left: 5px; padding-right: 5px; vertical-align: top; }\\n #aoeigwejsu .gt_row_group_first td { border-top-width: 2px; }\\n #aoeigwejsu .gt_row_group_first th { border-top-width: 2px; }\\n #aoeigwejsu .gt_striped { background-color: rgba(128,128,128,0.05); }\\n #aoeigwejsu .gt_table_body { border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }\\n #aoeigwejsu .gt_sourcenotes { color: #333333; background-color: #FFFFFF; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; }\\n #aoeigwejsu .gt_sourcenote { font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; text-align: left; }\\n #aoeigwejsu .gt_left { text-align: left; }\\n #aoeigwejsu .gt_center { text-align: center; }\\n #aoeigwejsu .gt_right { text-align: right; font-variant-numeric: tabular-nums; }\\n #aoeigwejsu .gt_font_normal { font-weight: normal; }\\n #aoeigwejsu .gt_font_bold { font-weight: bold; }\\n #aoeigwejsu .gt_font_italic { font-style: italic; }\\n #aoeigwejsu .gt_super { font-size: 65%; }\\n #aoeigwejsu .gt_footnote_marks { font-size: 75%; vertical-align: 0.4em; position: initial; }\\n #aoeigwejsu .gt_asterisk { font-size: 100%; vertical-align: 0; }\\n \\n</style>\\n<table class=\"gt_table\" data-quarto-disable-processing=\"false\" data-quarto-bootstrap=\"false\">\\n<thead>\\n\\n<tr class=\"gt_col_headings\">\\n <th class=\"gt_col_heading gt_columns_bottom_border gt_left\" rowspan=\"1\" colspan=\"1\" scope=\"col\" id=\"row\">row</th>\\n</tr>\\n</thead>\\n<tbody class=\"gt_table_body\">\\n <tr>\\n <td class=\"gt_row gt_left\">row_1</td>\\n </tr>\\n <tr>\\n <td class=\"gt_row gt_left\">row_2</td>\\n </tr>\\n <tr>\\n <td class=\"gt_row gt_left\">row_3</td>\\n </tr>\\n <tr>\\n <td class=\"gt_row gt_left\">row_4</td>\\n </tr>\\n <tr>\\n <td class=\"gt_row gt_left\">row_5</td>\\n </tr>\\n <tr>\\n <td class=\"gt_row gt_left\">row_6</td>\\n </tr>\\n <tr>\\n <td class=\"gt_row gt_left\">row_7</td>\\n </tr>\\n <tr>\\n <td class=\"gt_row gt_left\">row_8</td>\\n </tr>\\n</tbody>\\n\\n\\n</table>\\n\\n</div>\\n '\n\n\n\n\n\ncols_align\nGT.cols_align(self, align='left', columns=None)\nSet the alignment of one or more columns.\nThe cols_align() method sets the alignment of one or more columns. The align argument can be set to one of \"left\", \"center\", or \"right\" and the columns argument can be used to specify which columns to apply the alignment to. If columns is not specified, the alignment is applied to all columns.\n\nParameters\n\n\n\n\n\n\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\nalign\nstr\nThe alignment to apply. Must be one of \"left\", \"center\", or \"right\".\n'left'\n\n\ncolumns\nSelectExpr\nThe columns to target. Can either be a single column name or a series of column names provided in a list. If None, the alignment is applied to all columns.\nNone\n\n\n\n\n\nReturns\n\n\n\nType\nDescription\n\n\n\n\nGT\nThe GT object is returned. This is the same object that the method is called on so that we can facilitate method chaining.\n\n\n\n\n\nExamples\nLet’s use the countrypops to create a small table. We can change the alignment of the population column with cols_align(). In this example, the column label and body cells of population will be aligned to the left.\n\nfrom great_tables import GT\nfrom great_tables.data import countrypops\n\ncountrypops_mini = countrypops.loc[countrypops[\"country_name\"] == \"San Marino\"][\n [\"country_name\", \"year\", \"population\"]\n].tail(5)\n\n(\n GT(countrypops_mini, rowname_col=\"year\", groupname_col=\"country_name\")\n .cols_align(align=\"left\", columns=\"population\")\n)\n\n\n\n\n\n\n\n \n population\n\n\n\n \n San Marino\n \n \n 2018\n 34156\n \n \n 2019\n 34178\n \n \n 2020\n 34007\n \n \n 2021\n 33745\n \n \n 2022\n 33660\n \n\n\n\n\n\n\n \n\n\n\n\n\ncols_hide\nGT.cols_hide(self, columns)\nHide one or more columns.\nThe cols_hide() method allows us to hide one or more columns from appearing in the final output table. While it’s possible and often desirable to omit columns from the input table data before introduction to the GT() class, there can be cases where the data in certain columns is useful (as a column reference during formatting of other columns) but the final display of those columns is not necessary.\n\nParameters\n\n\n\n\n\n\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\ncolumns\nSelectExpr\nThe columns to hide in the output display table. Can either be a single column name or a series of column names provided in a list.\nrequired\n\n\n\n\n\nReturns\n\n\n\nType\nDescription\n\n\n\n\nGT\nThe GT object is returned. This is the same object that the method is called on so that we can facilitate method chaining.\n\n\n\n\n\nExamples\nFor this example, we’ll use a portion of the countrypops dataset to create a simple table. Let’s hide the year column with the cols_hide() method.\n\nfrom great_tables import GT\nfrom great_tables.data import countrypops\n\ncountrypops_mini = countrypops.loc[countrypops[\"country_name\"] == \"Benin\"][\n [\"country_name\", \"year\", \"population\"]\n].tail(5)\n\nGT(countrypops_mini).cols_hide(columns=\"year\")\n\n\n\n\n\n\n\n country_name\n population\n\n\n\n \n Benin\n 11940683\n \n \n Benin\n 12290444\n \n \n Benin\n 12643123\n \n \n Benin\n 12996895\n \n \n Benin\n 13352864\n \n\n\n\n\n\n\n \n\n\n\n\nDetails\nThe hiding of columns is internally a rendering directive, so, all columns that are ‘hidden’ are still accessible and useful in any expression provided to a rows argument. Furthermore, the cols_hide() method (as with many of the methods available in Great Tables) can be placed anywhere in a chain of calls (acting as a promise to hide columns when the timing is right). However there’s perhaps greater readability when placing this call closer to the end of such a chain. The cols_hide() method quietly changes the visible state of a column and doesn’t yield warnings when changing the state of already-invisible columns.\n\n\n\ncols_label\nGT.cols_label(self, cases=None, **kwargs)\nRelabel one or more columns.\nThere are three important pieces to labelling:\n\nEach argument has the form: {name in data} = {new label}.\nMultiple columns may be given the same label.\nLabels may use curly braces to apply special formatting, called unit notation. For example, “area ({{ft^2}})” would appear as “area (ft²)”.\n\nSee define_units() for details on unit notation.\n\nParameters\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\ncases\ndict[str, str | Text] | None\nA dictionary where the keys are column names and the values are the labels. Labels may use md() or html() helpers for formatting.\nNone\n\n\n**kwargs\nstr | Text\nKeyword arguments to specify column labels. Each keyword corresponds to a column name, with its value indicating the new label.\n{}\n\n\n\n\n\nReturns\n\n\n\nType\nDescription\n\n\n\n\nGT\nThe GT object is returned. This is the same object that the method is called on so that we can facilitate method chaining.\n\n\n\n\n\nNotes\nGT always selects columns using their name in the underlying data. This means that a column’s label is purely for final presentation.\n\n\nExamples\nThe example below relabels columns from the countrypops data to start with uppercase.\n\nfrom great_tables import GT\nfrom great_tables.data import countrypops\n\ncountrypops_mini = countrypops.loc[countrypops[\"country_name\"] == \"Uganda\"][\n [\"country_name\", \"year\", \"population\"]\n].tail(5)\n\n(\n GT(countrypops_mini)\n .cols_label(\n country_name=\"Country Name\",\n year=\"Year\",\n population=\"Population\"\n )\n)\n\n\n\n\n\n\n\n Country Name\n Year\n Population\n\n\n\n \n Uganda\n 2018\n 41515395\n \n \n Uganda\n 2019\n 42949080\n \n \n Uganda\n 2020\n 44404611\n \n \n Uganda\n 2021\n 45853778\n \n \n Uganda\n 2022\n 47249585\n \n\n\n\n\n\n\n \n\n\nNote that we supplied the name of the column as the key, and the new label as the value.\nWe can also use Markdown formatting for the column labels. In this example, we’ll use md(\"*Population*\") to make the label italicized.\n\nfrom great_tables import GT, md\nfrom great_tables.data import countrypops\n\n(\n GT(countrypops_mini)\n .cols_label(\n country_name=\"Name\",\n year=\"Year\",\n population=md(\"*Population*\")\n )\n)\n\n\n\n\n\n\n\n Name\n Year\n Population\n\n\n\n \n Uganda\n 2018\n 41515395\n \n \n Uganda\n 2019\n 42949080\n \n \n Uganda\n 2020\n 44404611\n \n \n Uganda\n 2021\n 45853778\n \n \n Uganda\n 2022\n 47249585\n \n\n\n\n\n\n\n \n\n\nWe can also use unit notation to format the column labels. In this example, we’ll use {cm^3 molecules^-1 s^-1} for part of the label for the OH_k298 column.\n\nfrom great_tables import GT\nfrom great_tables.data import reactions\nimport polars as pl\n\nreactions_mini = (\n pl.from_pandas(reactions)\n .filter(pl.col(\"cmpd_type\") == \"mercaptan\")\n .select([\"cmpd_name\", \"OH_k298\"])\n)\n\n(\n GT(reactions_mini)\n .fmt_scientific(\"OH_k298\")\n .sub_missing()\n .cols_label(\n cmpd_name=\"Compound Name\",\n OH_k298=\"OH, {{cm^3 molecules^-1 s^-1}}\",\n )\n)\n\n\n\n\n\n\n\n Compound Name\n OH, cm3 molecules−1 s−1\n\n\n\n \n methanethiol\n 3.50 × 10−11\n \n \n ethanethiol\n 4.50 × 10−11\n \n \n propanethiol\n 5.30 × 10−11\n \n \n 2-propanethiol\n 3.90 × 10−11\n \n \n 1-butanethiol\n 5.60 × 10−11\n \n \n 2-methyl-1-propanethiol\n 4.60 × 10−11\n \n \n 2-butanethiol\n 3.80 × 10−11\n \n \n t-butylsulfide\n 2.90 × 10−11\n \n \n 2-methylbutanethiol\n 5.20 × 10−11\n \n \n n-pentanethiol\n —\n \n \n 1,2-ethanedithiol\n 3.80 × 10−11\n \n\n\n\n\n\n\n \n\n\n\n\n\ncols_move\nGT.cols_move(self, columns, after)\nMove one or more columns.\nOn those occasions where you need to move columns this way or that way, we can make use of the cols_move() method. While it’s true that the movement of columns can be done upstream of Great Tables, it is much easier and less error prone to use the method provided here. The movement procedure here takes one or more specified columns (in the columns argument) and places them to the right of a different column (the after argument). The ordering of the columns to be moved is preserved, as is the ordering of all other columns in the table.\nThe columns supplied in columns must all exist in the table and none of them can be in the after argument. The after column must also exist and only one column should be provided here. If you need to place one more or columns at the beginning of the column series, the cols_move_to_start() method should be used. Similarly, if those columns to move should be placed at the end of the column series then use cols_move_to_end().\n\nParameters\n\n\n\n\n\n\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\ncolumns\nSelectExpr\nThe columns to target. Can either be a single column name or a series of column names provided in a list.\nrequired\n\n\nafter\nstr\nThe column after which the columns should be placed. This can be any column name that exists in the table.\nrequired\n\n\n\n\n\nReturns\n\n\n\nType\nDescription\n\n\n\n\nGT\nThe GT object is returned. This is the same object that the method is called on so that we can facilitate method chaining.\n\n\n\n\n\nExamples\nLet’s use the countrypops dataset to create a table. We’ll choose to position the population column after the country_name column by using the cols_move() method.\n\nfrom great_tables import GT\nfrom great_tables.data import countrypops\n\ncountrypops_mini = countrypops.loc[countrypops[\"country_name\"] == \"Japan\"][\n [\"country_name\", \"year\", \"population\"]\n].tail(5)\n\n(\n GT(countrypops_mini)\n .cols_move(\n columns=\"population\",\n after=\"country_name\"\n )\n)\n\n\n\n\n\n\n\n country_name\n population\n year\n\n\n\n \n Japan\n 126811000\n 2018\n \n \n Japan\n 126633000\n 2019\n \n \n Japan\n 126261000\n 2020\n \n \n Japan\n 125681593\n 2021\n \n \n Japan\n 125124989\n 2022\n \n\n\n\n\n\n\n \n\n\n\n\n\ncols_move_to_end\nGT.cols_move_to_end(self, columns)\nMove one or more columns to the end.\nWe can easily move set of columns to the beginning of the column series and we only need to specify which columns. It’s possible to do this upstream of Great Tables, however, it is easier with this method and it presents less possibility for error. The ordering of the columns that are moved to the end is preserved (same with the ordering of all other columns in the table).\n\nParameters\n\n\n\n\n\n\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\ncolumns\nSelectExpr\nThe columns to target. Can either be a single column name or a series of column names provided in a list.\nrequired\n\n\n\n\n\nReturns\n\n\n\nType\nDescription\n\n\n\n\nGT\nThe GT object is returned. This is the same object that the method is called on so that we can facilitate method chaining.\n\n\n\n\n\nExamples\nFor this example, we’ll use a portion of the countrypops dataset to create a simple table. Let’s move the year column, which is the middle column, to the end of the column series with the cols_move_to_end() method.\n\nfrom great_tables import GT\nfrom great_tables.data import countrypops\n\ncountrypops_mini = countrypops.loc[countrypops[\"country_name\"] == \"Benin\"][\n [\"country_name\", \"year\", \"population\"]\n].tail(5)\n\nGT(countrypops_mini).cols_move_to_end(columns=\"year\")\n\n\n\n\n\n\n\n country_name\n population\n year\n\n\n\n \n Benin\n 11940683\n 2018\n \n \n Benin\n 12290444\n 2019\n \n \n Benin\n 12643123\n 2020\n \n \n Benin\n 12996895\n 2021\n \n \n Benin\n 13352864\n 2022\n \n\n\n\n\n\n\n \n\n\nWe can also move multiple columns at a time. With the same countrypops-based table (countrypops_mini), let’s move both the year and country_name columns to the end of the column series.\n\nGT(countrypops_mini).cols_move_to_end(columns=[\"year\", \"country_name\"])\n\n\n\n\n\n\n\n population\n year\n country_name\n\n\n\n \n 11940683\n 2018\n Benin\n \n \n 12290444\n 2019\n Benin\n \n \n 12643123\n 2020\n Benin\n \n \n 12996895\n 2021\n Benin\n \n \n 13352864\n 2022\n Benin\n \n\n\n\n\n\n\n \n\n\n\n\n\ncols_move_to_start\nGT.cols_move_to_start(self, columns)\nMove one or more columns to the start.\nWe can easily move set of columns to the beginning of the column series and we only need to specify which columns. It’s possible to do this upstream of Great Tables, however, it is easier with this method and it presents less possibility for error. The ordering of the columns that are moved to the start is preserved (same with the ordering of all other columns in the table).\nThe columns supplied in columns must all exist in the table. If you need to place one or columns at the end of the column series, the cols_move_to_end() method should be used. More control is offered with the cols_move() method, where columns could be placed after a specific column.\n\nParameters\n\n\n\n\n\n\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\ncolumns\nSelectExpr\nThe columns to target. Can either be a single column name or a series of column names provided in a list.\nrequired\n\n\n\n\n\nReturns\n\n\n\nType\nDescription\n\n\n\n\nGT\nThe GT object is returned. This is the same object that the method is called on so that we can facilitate method chaining.\n\n\n\n\n\nExamples\nFor this example, we’ll use a portion of the countrypops dataset to create a simple table. Let’s move the year column, which is the middle column, to the start of the column series with the cols_move_to_start() method.\n\nfrom great_tables import GT\nfrom great_tables.data import countrypops\n\ncountrypops_mini = countrypops.loc[countrypops[\"country_name\"] == \"Fiji\"][\n [\"country_name\", \"year\", \"population\"]\n].tail(5)\n\nGT(countrypops_mini).cols_move_to_start(columns=\"year\")\n\n\n\n\n\n\n\n year\n country_name\n population\n\n\n\n \n 2018\n Fiji\n 918996\n \n \n 2019\n Fiji\n 918465\n \n \n 2020\n Fiji\n 920422\n \n \n 2021\n Fiji\n 924610\n \n \n 2022\n Fiji\n 929766\n \n\n\n\n\n\n\n \n\n\nWe can also move multiple columns at a time. With the same countrypops-based table (countrypops_mini), let’s move both the year and population columns to the start of the column series.\n\nGT(countrypops_mini).cols_move_to_start(columns=[\"year\", \"population\"])\n\n\n\n\n\n\n\n year\n population\n country_name\n\n\n\n \n 2018\n 918996\n Fiji\n \n \n 2019\n 918465\n Fiji\n \n \n 2020\n 920422\n Fiji\n \n \n 2021\n 924610\n Fiji\n \n \n 2022\n 929766\n Fiji\n \n\n\n\n\n\n\n \n\n\n\n\n\ncols_width\nGT.cols_width(self, cases=None, **kwargs)\nSet the widths of columns.\nManual specifications of column widths can be performed using the cols_width() method. We choose which columns get specific widths. This can be in units of pixels or as percentages. Width assignments are supplied inside of a dictionary where columns are the keys and the corresponding width is the value.\n\nParameters\n\n\n\n\n\n\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\ncases\ndict[str, str] | None\nA dictionary where the keys are column names and the values are the widths. Widths can be specified in pixels (e.g., \"50px\") or as percentages (e.g., \"20%\").\nNone\n\n\n**kwargs\nstr\nKeyword arguments to specify column widths. Each keyword corresponds to a column name, with its value indicating the width in pixels or percentages.\n{}\n\n\n\n\n\nReturns\n\n\n\nType\nDescription\n\n\n\n\nGT\nThe GT object is returned. This is the same object that the method is called on so that we can facilitate method chaining.\n\n\n\n\n\nExamples\nLet’s use select columns from the exibble dataset to create a new table. We can specify the widths of columns with cols_width(). This is done by specifying the exact widths for table columns in a dictionary. In this example, we’ll set the width of the num column to \"150px\", the char column to \"100px\", the date column to \"300px\". All other columns won’t be affected (their widths will be automatically set by their content).\n\nfrom great_tables import GT, exibble\n\nexibble_mini = exibble[[\"num\", \"char\", \"date\", \"datetime\", \"row\"]].head(5)\n\n(\n GT(exibble_mini)\n .cols_width(\n cases={\n \"num\": \"150px\",\n \"char\": \"100px\",\n \"date\": \"300px\"\n }\n )\n)\n\n\n\n\n\n \n \n \n \n \n\n\n\n\n\n num\n char\n date\n datetime\n row\n\n\n\n \n 0.1111\n apricot\n 2015-01-15\n 2018-01-01 02:22\n row_1\n \n \n 2.222\n banana\n 2015-02-15\n 2018-02-02 14:33\n row_2\n \n \n 33.33\n coconut\n 2015-03-15\n 2018-03-03 03:44\n row_3\n \n \n 444.4\n durian\n 2015-04-15\n 2018-04-04 15:55\n row_4\n \n \n 5550.0\n \n 2015-05-15\n 2018-05-05 04:00\n row_5\n \n\n\n\n\n\n\n \n\n\nWe can also specify the widths of columns as percentages. In this example, we’ll set the width of the num column to \"20%\", the char column to \"10%\", and the date column to \"30%\". Note that the percentages are relative and don’t need to sum to 100%.\n\n(\n GT(exibble_mini)\n .cols_width(\n cases={\n \"num\": \"20%\",\n \"char\": \"10%\",\n \"date\": \"30%\"\n }\n )\n)\n\n\n\n\n\n \n \n \n \n \n\n\n\n\n\n num\n char\n date\n datetime\n row\n\n\n\n \n 0.1111\n apricot\n 2015-01-15\n 2018-01-01 02:22\n row_1\n \n \n 2.222\n banana\n 2015-02-15\n 2018-02-02 14:33\n row_2\n \n \n 33.33\n coconut\n 2015-03-15\n 2018-03-03 03:44\n row_3\n \n \n 444.4\n durian\n 2015-04-15\n 2018-04-04 15:55\n row_4\n \n \n 5550.0\n \n 2015-05-15\n 2018-05-05 04:00\n row_5\n \n\n\n\n\n\n\n \n\n\nWe can also mix and match pixel and percentage widths. In this example, we’ll set the width of the num column to \"150px\", the char column to \"10%\", and the date column to \"30%\".\n\n(\n GT(exibble_mini)\n .cols_width(\n cases={\n \"num\": \"150px\",\n \"char\": \"10%\",\n \"date\": \"30%\"\n }\n )\n)\n\n\n\n\n\n \n \n \n \n \n\n\n\n\n\n num\n char\n date\n datetime\n row\n\n\n\n \n 0.1111\n apricot\n 2015-01-15\n 2018-01-01 02:22\n row_1\n \n \n 2.222\n banana\n 2015-02-15\n 2018-02-02 14:33\n row_2\n \n \n 33.33\n coconut\n 2015-03-15\n 2018-03-03 03:44\n row_3\n \n \n 444.4\n durian\n 2015-04-15\n 2018-04-04 15:55\n row_4\n \n \n 5550.0\n \n 2015-05-15\n 2018-05-05 04:00\n row_5\n \n\n\n\n\n\n\n \n\n\nIf we set the width of all columns, the table will be forced to use the specified widths (i.e., a column width less than the content width will be honored). In this next example, we’ll set widths for all columns. This is a good way to ensure that the widths you specify are fully respected (and not overridden by automatic width calculations).\n\n(\n GT(exibble_mini)\n .cols_width(\n cases={\n \"num\": \"30px\",\n \"char\": \"100px\",\n \"date\": \"100px\",\n \"datetime\": \"200px\",\n \"row\": \"50px\"\n }\n )\n)\n\n\n\n\n\n \n \n \n \n \n\n\n\n\n\n num\n char\n date\n datetime\n row\n\n\n\n \n 0.1111\n apricot\n 2015-01-15\n 2018-01-01 02:22\n row_1\n \n \n 2.222\n banana\n 2015-02-15\n 2018-02-02 14:33\n row_2\n \n \n 33.33\n coconut\n 2015-03-15\n 2018-03-03 03:44\n row_3\n \n \n 444.4\n durian\n 2015-04-15\n 2018-04-04 15:55\n row_4\n \n \n 5550.0\n \n 2015-05-15\n 2018-05-05 04:00\n row_5\n \n\n\n\n\n\n\n \n\n\nNotice that in the above example, the num column is very small (only 30px) and the content overflows. When not specifying the width of all columns, the table will automatically adjust the column widths based on the content (and you wouldn’t get the overflowing behavior seen in the previous example).\n\n\n\ndata_color\nGT.data_color(self, columns=None, rows=None, palette=None, domain=None, na_color=None, alpha=None, reverse=False, autocolor_text=True)\nPerform data cell colorization.\nIt’s possible to add color to data cells according to their values with the data_color() method. There is a multitude of ways to perform data cell colorizing here:\n\ntargeting: we can constrain which columns should receive the colorization treatment through the columns= argument)\ncolor palettes: with palette= we could supply a list of colors composed of hexadecimal values or color names\nvalue domain: we can either opt to have the range of values define the domain, or, specify one explicitly with the domain= argument\ntext autocoloring: data_color() will automatically recolor the foreground text to provide the best contrast (can be deactivated with autocolor_text=False)\n\n\nParameters\n\n\n\n\n\n\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\ncolumns\nSelectExpr\nThe columns to target. Can either be a single column name or a series of column names provided in a list.\nNone\n\n\nrows\nRowSelectExpr\nIn conjunction with columns=, we can specify which rows should be colored. By default, all rows in the targeted columns will be colored. Alternatively, we can provide a list of row indices.\nNone\n\n\npalette\nstr | list[str] | None\nThe color palette to use. This should be a list of colors (e.g., [\"#FF0000\", \"#00FF00\", \"#0000FF\"]). A ColorBrewer palette could also be used, just supply the name (reference available in the Color palette access from ColorBrewer section). If None, then a default palette will be used.\nNone\n\n\ndomain\nlist[str] | list[int] | list[float] | None\nThe domain of values to use for the color scheme. This can be a list of floats, integers, or strings. If None, then the domain will be inferred from the data values.\nNone\n\n\nna_color\nstr | None\nThe color to use for missing values. If None, then the default color (\"#808080\") will be used.\nNone\n\n\nalpha\nint | float | None\nAn optional, fixed alpha transparency value that will be applied to all color palette values.\nNone\n\n\nreverse\nbool\nShould the colors computed operate in the reverse order? If True then colors that normally change from red to blue will change in the opposite direction.\nFalse\n\n\nautocolor_text\nbool\nWhether or not to automatically color the text of the data values. If True, then the text will be colored according to the background color of the cell.\nTrue\n\n\n\n\n\nReturns\n\n\n\nType\nDescription\n\n\n\n\nGT\nThe GT object is returned. This is the same object that the method is called on so that we can facilitate method chaining.\n\n\n\n\n\nColor Palette Access From Colorbrewer And Viridis\nAll palettes from the ColorBrewer package can be accessed by providing the palette name in palette=. There are 35 available palettes:\n\n\n\n\nPalette Name\nColors\nCategory\nColorblind Friendly\n\n\n\n\n1\n\"BrBG\"\n11\nDiverging\nYes\n\n\n2\n\"PiYG\"\n11\nDiverging\nYes\n\n\n3\n\"PRGn\"\n11\nDiverging\nYes\n\n\n4\n\"PuOr\"\n11\nDiverging\nYes\n\n\n5\n\"RdBu\"\n11\nDiverging\nYes\n\n\n6\n\"RdYlBu\"\n11\nDiverging\nYes\n\n\n7\n\"RdGy\"\n11\nDiverging\nNo\n\n\n8\n\"RdYlGn\"\n11\nDiverging\nNo\n\n\n9\n\"Spectral\"\n11\nDiverging\nNo\n\n\n10\n\"Dark2\"\n8\nQualitative\nYes\n\n\n11\n\"Paired\"\n12\nQualitative\nYes\n\n\n12\n\"Set1\"\n9\nQualitative\nNo\n\n\n13\n\"Set2\"\n8\nQualitative\nYes\n\n\n14\n\"Set3\"\n12\nQualitative\nNo\n\n\n15\n\"Accent\"\n8\nQualitative\nNo\n\n\n16\n\"Pastel1\"\n9\nQualitative\nNo\n\n\n17\n\"Pastel2\"\n8\nQualitative\nNo\n\n\n18\n\"Blues\"\n9\nSequential\nYes\n\n\n19\n\"BuGn\"\n9\nSequential\nYes\n\n\n20\n\"BuPu\"\n9\nSequential\nYes\n\n\n21\n\"GnBu\"\n9\nSequential\nYes\n\n\n22\n\"Greens\"\n9\nSequential\nYes\n\n\n23\n\"Greys\"\n9\nSequential\nYes\n\n\n24\n\"Oranges\"\n9\nSequential\nYes\n\n\n25\n\"OrRd\"\n9\nSequential\nYes\n\n\n26\n\"PuBu\"\n9\nSequential\nYes\n\n\n27\n\"PuBuGn\"\n9\nSequential\nYes\n\n\n28\n\"PuRd\"\n9\nSequential\nYes\n\n\n29\n\"Purples\"\n9\nSequential\nYes\n\n\n30\n\"RdPu\"\n9\nSequential\nYes\n\n\n31\n\"Reds\"\n9\nSequential\nYes\n\n\n32\n\"YlGn\"\n9\nSequential\nYes\n\n\n33\n\"YlGnBu\"\n9\nSequential\nYes\n\n\n34\n\"YlOrBr\"\n9\nSequential\nYes\n\n\n35\n\"YlOrRd\"\n9\nSequential\nYes\n\n\n\nWe can also use the viridis and associated color palettes by providing to palette= any of the following string values: \"viridis\", \"plasma\", \"inferno\", \"magma\", or \"cividis\".\n\n\nExamples\nThe data_color() method can be used without any supplied arguments to colorize a table. Let’s do this with the exibble dataset:\n\nfrom great_tables import GT\nfrom great_tables.data import exibble\n\nGT(exibble).data_color()\n\n\n\n\n\n\n\n num\n char\n fctr\n date\n time\n datetime\n currency\n row\n group\n\n\n\n \n 0.1111\n apricot\n one\n 2015-01-15\n 13:35\n 2018-01-01 02:22\n 49.95\n row_1\n grp_a\n \n \n 2.222\n banana\n two\n 2015-02-15\n 14:40\n 2018-02-02 14:33\n 17.95\n row_2\n grp_a\n \n \n 33.33\n coconut\n three\n 2015-03-15\n 15:45\n 2018-03-03 03:44\n 1.39\n row_3\n grp_a\n \n \n 444.4\n durian\n four\n 2015-04-15\n 16:50\n 2018-04-04 15:55\n 65100.0\n row_4\n grp_a\n \n \n 5550.0\n \n five\n 2015-05-15\n 17:55\n 2018-05-05 04:00\n 1325.81\n row_5\n grp_b\n \n \n \n fig\n six\n 2015-06-15\n \n 2018-06-06 16:11\n 13.255\n row_6\n grp_b\n \n \n 777000.0\n grapefruit\n seven\n \n 19:10\n 2018-07-07 05:22\n \n row_7\n grp_b\n \n \n 8880000.0\n honeydew\n eight\n 2015-08-15\n 20:20\n \n 0.44\n row_8\n grp_b\n \n\n\n\n\n\n\n \n\n\nWhat’s happened is that data_color() applies background colors to all cells of every column with the palette of eight colors. Numeric columns will use ‘numeric’ methodology for color scaling whereas string-based columns will use the ‘factor’ methodology. The text color undergoes an automatic modification that maximizes contrast (since autocolor_text=True by default).\nWe can target specific colors and apply color to just those columns. Let’s do that and also supply palette= values of \"red\" and \"green\".\n\nGT(exibble).data_color(\n columns=[\"num\", \"currency\"],\n palette=[\"red\", \"green\"]\n)\n\n\n\n\n\n\n\n num\n char\n fctr\n date\n time\n datetime\n currency\n row\n group\n\n\n\n \n 0.1111\n apricot\n one\n 2015-01-15\n 13:35\n 2018-01-01 02:22\n 49.95\n row_1\n grp_a\n \n \n 2.222\n banana\n two\n 2015-02-15\n 14:40\n 2018-02-02 14:33\n 17.95\n row_2\n grp_a\n \n \n 33.33\n coconut\n three\n 2015-03-15\n 15:45\n 2018-03-03 03:44\n 1.39\n row_3\n grp_a\n \n \n 444.4\n durian\n four\n 2015-04-15\n 16:50\n 2018-04-04 15:55\n 65100.0\n row_4\n grp_a\n \n \n 5550.0\n \n five\n 2015-05-15\n 17:55\n 2018-05-05 04:00\n 1325.81\n row_5\n grp_b\n \n \n \n fig\n six\n 2015-06-15\n \n 2018-06-06 16:11\n 13.255\n row_6\n grp_b\n \n \n 777000.0\n grapefruit\n seven\n \n 19:10\n 2018-07-07 05:22\n \n row_7\n grp_b\n \n \n 8880000.0\n honeydew\n eight\n 2015-08-15\n 20:20\n \n 0.44\n row_8\n grp_b\n \n\n\n\n\n\n\n \n\n\nWith those options in place we see that only the numeric columns num and currency received color treatments. Moreover, the palette colors were mapped to the lower and upper limits of the data in each column; interpolated colors were used for the values in between the numeric limits of the two columns.\nWe can manually set the limits of the data with the domain= argument (which is preferable in most cases). Let’s colorize just the currency column and set domain=[0, 50]. Any values that are either missing or lie outside of the domain will be colorized with the na_color= color (so we’ll set that to \"lightgray\").\n\nGT(exibble).data_color(\n columns=\"currency\",\n palette=[\"red\", \"green\"],\n domain=[0, 50],\n na_color=\"lightgray\"\n)\n\n\n\n\n\n\n\n num\n char\n fctr\n date\n time\n datetime\n currency\n row\n group\n\n\n\n \n 0.1111\n apricot\n one\n 2015-01-15\n 13:35\n 2018-01-01 02:22\n 49.95\n row_1\n grp_a\n \n \n 2.222\n banana\n two\n 2015-02-15\n 14:40\n 2018-02-02 14:33\n 17.95\n row_2\n grp_a\n \n \n 33.33\n coconut\n three\n 2015-03-15\n 15:45\n 2018-03-03 03:44\n 1.39\n row_3\n grp_a\n \n \n 444.4\n durian\n four\n 2015-04-15\n 16:50\n 2018-04-04 15:55\n 65100.0\n row_4\n grp_a\n \n \n 5550.0\n \n five\n 2015-05-15\n 17:55\n 2018-05-05 04:00\n 1325.81\n row_5\n grp_b\n \n \n \n fig\n six\n 2015-06-15\n \n 2018-06-06 16:11\n 13.255\n row_6\n grp_b\n \n \n 777000.0\n grapefruit\n seven\n \n 19:10\n 2018-07-07 05:22\n \n row_7\n grp_b\n \n \n 8880000.0\n honeydew\n eight\n 2015-08-15\n 20:20\n \n 0.44\n row_8\n grp_b\n \n\n\n\n\n\n\n \n\n\n\n\n\nfmt\nGT.fmt(self, fns, columns=None, rows=None, is_substitution=False)\nSet a column format with a formatter function.\nThe fmt() method provides a way to execute custom formatting functionality with raw data values in a way that can consider all output contexts.\nAlong with the columns and rows arguments that provide some precision in targeting data cells, the fns argument allows you to define one or more functions for manipulating the raw data.\n\nParameters\n\n\n\n\n\n\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\nfns\nFormatFn | FormatFns\nEither a single formatting function or a named list of functions.\nrequired\n\n\ncolumns\nSelectExpr\nThe columns to target. Can either be a single column name or a series of column names provided in a list.\nNone\n\n\nrows\nint | list[int] | None\nIn conjunction with columns=, we can specify which of their rows should undergo formatting. The default is all rows, resulting in all rows in columns being formatted. Alternatively, we can supply a list of row indices.\nNone\n\n\nis_substitution\nbool\nWhether the formatter is a substitution. Substitutions are run last, after other formatters.\nFalse\n\n\n\n\n\nReturns\n\n\n\nType\nDescription\n\n\n\n\nGT\nThe GT object is returned. This is the same object that the method is called on so that we can facilitate method chaining.\n\n\n\n\n\nExamples\nLet’s use the exibble dataset to create a table. With the fmt() method, we’ll add a prefix ^ and a suffix $ to the row and group columns.\n\nfrom great_tables import GT, exibble\n\n(\n GT(exibble)\n .fmt(lambda x: f\"^{x}$\", columns=[\"row\", \"group\"])\n)\n\n\n\n\n\n\n\n num\n char\n fctr\n date\n time\n datetime\n currency\n row\n group\n\n\n\n \n 0.1111\n apricot\n one\n 2015-01-15\n 13:35\n 2018-01-01 02:22\n 49.95\n ^row_1$\n ^grp_a$\n \n \n 2.222\n banana\n two\n 2015-02-15\n 14:40\n 2018-02-02 14:33\n 17.95\n ^row_2$\n ^grp_a$\n \n \n 33.33\n coconut\n three\n 2015-03-15\n 15:45\n 2018-03-03 03:44\n 1.39\n ^row_3$\n ^grp_a$\n \n \n 444.4\n durian\n four\n 2015-04-15\n 16:50\n 2018-04-04 15:55\n 65100.0\n ^row_4$\n ^grp_a$\n \n \n 5550.0\n \n five\n 2015-05-15\n 17:55\n 2018-05-05 04:00\n 1325.81\n ^row_5$\n ^grp_b$\n \n \n \n fig\n six\n 2015-06-15\n \n 2018-06-06 16:11\n 13.255\n ^row_6$\n ^grp_b$\n \n \n 777000.0\n grapefruit\n seven\n \n 19:10\n 2018-07-07 05:22\n \n ^row_7$\n ^grp_b$\n \n \n 8880000.0\n honeydew\n eight\n 2015-08-15\n 20:20\n \n 0.44\n ^row_8$\n ^grp_b$\n \n\n\n\n\n\n\n \n\n\n\n\n\nfmt_bytes\nGT.fmt_bytes(self, columns=None, rows=None, standard='decimal', decimals=1, n_sigfig=None, drop_trailing_zeros=True, drop_trailing_dec_mark=True, use_seps=True, pattern='{x}', sep_mark=',', dec_mark='.', force_sign=False, incl_space=True, locale=None)\nFormat values as bytes.\nWith numeric values in a table, we can transform those to values of bytes with human readable units. The fmt_bytes() method allows for the formatting of byte sizes to either of two common representations: (1) with decimal units (powers of 1000, examples being \"kB\" and \"MB\"), and (2) with binary units (powers of 1024, examples being \"KiB\" and \"MiB\"). It is assumed the input numeric values represent the number of bytes and automatic truncation of values will occur. The numeric values will be scaled to be in the range of 1 to <1000 and then decorated with the correct unit symbol according to the standard chosen. For more control over the formatting of byte sizes, we can use the following options:\n\ndecimals: choice of the number of decimal places, option to drop trailing zeros, and a choice of the decimal symbol\ndigit grouping separators: options to enable/disable digit separators and provide a choice of separator symbol\npattern: option to use a text pattern for decoration of the formatted values\nlocale-based formatting: providing a locale ID will result in number formatting specific to the chosen locale\n\n\nParameters\n\n\n\n\n\n\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\ncolumns\nSelectExpr\nThe columns to target. Can either be a single column name or a series of column names provided in a list.\nNone\n\n\nrows\nint | list[int] | None\nIn conjunction with columns=, we can specify which of their rows should undergo formatting. The default is all rows, resulting in all rows in targeted columns being formatted. Alternatively, we can supply a list of row indices.\nNone\n\n\nstandard\nstr\nThe form of expressing large byte sizes is divided between: (1) decimal units (powers of 1000; e.g., \"kB\" and \"MB\"), and (2) binary units (powers of 1024; e.g., \"KiB\" and \"MiB\"). The default is to use decimal units with the \"decimal\" option. The alternative is to use binary units with the \"binary\" option.\n'decimal'\n\n\ndecimals\nint\nThis corresponds to the exact number of decimal places to use. A value such as 2.34 can, for example, be formatted with 0 decimal places and it would result in \"2\". With 4 decimal places, the formatted value becomes \"2.3400\". The trailing zeros can be removed with drop_trailing_zeros=True.\n1\n\n\ndrop_trailing_zeros\nbool\nA boolean value that allows for removal of trailing zeros (those redundant zeros after the decimal mark).\nTrue\n\n\ndrop_trailing_dec_mark\nbool\nA boolean value that determines whether decimal marks should always appear even if there are no decimal digits to display after formatting (e.g., 23 becomes 23. if False). By default trailing decimal marks are not shown.\nTrue\n\n\nuse_seps\nbool\nThe use_seps option allows for the use of digit group separators. The type of digit group separator is set by sep_mark and overridden if a locale ID is provided to locale. This setting is True by default.\nTrue\n\n\npattern\nstr\nA formatting pattern that allows for decoration of the formatted value. The formatted value is represented by the {x} (which can be used multiple times, if needed) and all other characters will be interpreted as string literals.\n'{x}'\n\n\nsep_mark\nstr\nThe string to use as a separator between groups of digits. For example, using sep_mark=\",\" with a value of 1000 would result in a formatted value of \"1,000\". This argument is ignored if a locale is supplied (i.e., is not None).\n','\n\n\ndec_mark\nstr\nThe string to be used as the decimal mark. For example, using dec_mark=\",\" with the value 0.152 would result in a formatted value of \"0,152\"). This argument is ignored if a locale is supplied (i.e., is not None).\n'.'\n\n\nforce_sign\nbool\nShould the positive sign be shown for positive values (effectively showing a sign for all values except zero)? If so, use True for this option. The default is False, where only negative numbers will display a minus sign.\nFalse\n\n\nincl_space\nbool\nAn option for whether to include a space between the value and the currency symbol. The default is to not introduce a space character.\nTrue\n\n\nlocale\nstr | None\nAn optional locale identifier that can be used for formatting values according the locale’s rules. Examples include \"en\" for English (United States) and \"fr\" for French (France).\nNone\n\n\n\n\n\nReturns\n\n\n\nType\nDescription\n\n\n\n\nGT\nThe GT object is returned. This is the same object that the method is called on so that we can facilitate method chaining.\n\n\n\n\n\nAdapting Output To A Specific Locale\nThis formatting method can adapt outputs according to a provided locale value. Examples include \"en\" for English (United States) and \"fr\" for French (France). The use of a valid locale ID here means separator and decimal marks will be correct for the given locale. Should any values be provided in sep_mark or dec_mark, they will be overridden by the locale’s preferred values.\nNote that a locale value provided here will override any global locale setting performed in GT()’s own locale argument (it is settable there as a value received by all other methods that have a locale argument).\n\n\nExamples\nLet’s use a single column from the exibble dataset and create a new table. We’ll format the num column to display as byte sizes in the decimal standard through use of the fmt_bytes() method.\n\nfrom great_tables import GT, exibble\n\n(\n GT(exibble[[\"num\"]])\n .fmt_bytes(columns=\"num\", standard=\"decimal\")\n)\n\n\n\n\n\n\n\n num\n\n\n\n \n 0 B\n \n \n 2 B\n \n \n 33 B\n \n \n 444 B\n \n \n 5.5 kB\n \n \n \n \n \n 777 kB\n \n \n 8.9 MB\n \n\n\n\n\n\n\n \n\n\n\n\nSee Also\nThe functional version of this method, val_fmt_bytes(), allows you to format a single numerical value (or a list of them).\n\n\n\nfmt_currency\nGT.fmt_currency(self, columns=None, rows=None, currency=None, use_subunits=True, decimals=None, drop_trailing_dec_mark=True, use_seps=True, scale_by=1, pattern='{x}', sep_mark=',', dec_mark='.', force_sign=False, placement='left', incl_space=False, locale=None)\nFormat values as currencies.\nWith numeric values in a gt table, we can perform currency-based formatting with the fmt_currency() method. This supports both automatic formatting with a three-letter currency code. We have fine control over the conversion from numeric values to currency values, where we could take advantage of the following options:\n\nthe currency: providing a currency code or common currency name will procure the correct currency symbol and number of currency subunits\ncurrency symbol placement: the currency symbol can be placed before or after the values\ndecimals/subunits: choice of the number of decimal places, and a choice of the decimal symbol, and an option on whether to include or exclude the currency subunits (the decimal portion)\ndigit grouping separators: options to enable/disable digit separators and provide a choice of separator symbol\nscaling: we can choose to scale targeted values by a multiplier value\npattern: option to use a text pattern for decoration of the formatted currency values\nlocale-based formatting: providing a locale ID will result in currency formatting specific to the chosen locale; it will also retrieve the locale’s currency if none is explicitly given\n\n\nParameters\n\n\n\n\n\n\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\ncolumns\nSelectExpr\nThe columns to target. Can either be a single column name or a series of column names provided in a list.\nNone\n\n\nrows\nint | list[int] | None\nIn conjunction with columns=, we can specify which of their rows should undergo formatting. The default is all rows, resulting in all rows in targeted columns being formatted. Alternatively, we can supply a list of row indices.\nNone\n\n\ncurrency\nstr | None\nThe currency to use for the numeric value. This input can be supplied as a 3-letter currency code (e.g., \"USD\" for U.S. Dollars, \"EUR\" for the Euro currency).\nNone\n\n\nuse_subunits\nbool\nAn option for whether the subunits portion of a currency value should be displayed. For example, with an input value of 273.81, the default formatting will produce \"$273.81\". Removing the subunits (with use_subunits = False) will give us \"$273\".\nTrue\n\n\ndecimals\nint | None\nThe decimals values corresponds to the exact number of decimal places to use. This value is optional as a currency has an intrinsic number of decimal places (i.e., the subunits). A value such as 2.34 can, for example, be formatted with 0 decimal places and if the currency used is \"USD\" it would result in \"$2\". With 4 decimal places, the formatted value becomes \"$2.3400\".\nNone\n\n\ndrop_trailing_dec_mark\nbool\nA boolean value that determines whether decimal marks should always appear even if there are no decimal digits to display after formatting (e.g., 23 becomes 23. if False). By default trailing decimal marks are not shown.\nTrue\n\n\nuse_seps\nbool\nThe use_seps option allows for the use of digit group separators. The type of digit group separator is set by sep_mark and overridden if a locale ID is provided to locale. This setting is True by default.\nTrue\n\n\nscale_by\nfloat\nAll numeric values will be multiplied by the scale_by value before undergoing formatting. Since the default value is 1, no values will be changed unless a different multiplier value is supplied.\n1\n\n\npattern\nstr\nA formatting pattern that allows for decoration of the formatted value. The formatted value is represented by the {x} (which can be used multiple times, if needed) and all other characters will be interpreted as string literals.\n'{x}'\n\n\nsep_mark\nstr\nThe string to use as a separator between groups of digits. For example, using sep_mark=\",\" with a value of 1000 would result in a formatted value of \"1,000\". This argument is ignored if a locale is supplied (i.e., is not None).\n','\n\n\ndec_mark\nstr\nThe string to be used as the decimal mark. For example, using dec_mark=\",\" with the value 0.152 would result in a formatted value of \"0,152\"). This argument is ignored if a locale is supplied (i.e., is not None).\n'.'\n\n\nforce_sign\nbool\nShould the positive sign be shown for positive values (effectively showing a sign for all values except zero)? If so, use True for this option. The default is False, where only negative numbers will display a minus sign.\nFalse\n\n\nplacement\nstr\nThe placement of the currency symbol. This can be either be \"left\" (as in \"$450\") or \"right\" (which yields \"450$\").\n'left'\n\n\nincl_space\nbool\nAn option for whether to include a space between the value and the currency symbol. The default is to not introduce a space character.\nFalse\n\n\nlocale\nstr | None\nAn optional locale identifier that can be used for formatting values according the locale’s rules. Examples include \"en\" for English (United States) and \"fr\" for French (France).\nNone\n\n\n\n\n\nReturns\n\n\n\nType\nDescription\n\n\n\n\nGT\nThe GT object is returned. This is the same object that the method is called on so that we can facilitate method chaining.\n\n\n\n\n\nAdapting Output To A Specific Locale\nThis formatting method can adapt outputs according to a provided locale value. Examples include \"en\" for English (United States) and \"fr\" for French (France). The use of a valid locale ID here means separator and decimal marks will be correct for the given locale. Should any values be provided in sep_mark or dec_mark, they will be overridden by the locale’s preferred values. In addition to number formatting, providing a locale value and not providing a currency allows Great Tables to obtain the currency code from the locale’s territory.\nNote that a locale value provided here will override any global locale setting performed in GT()’s own locale argument (it is settable there as a value received by all other methods that have a locale argument).\n\n\nExamples\nLet’s use the exibble dataset to create a table. With the fmt_currency() method, we’ll format the currency column to display monetary values.\n\nfrom great_tables import GT, exibble\n\n(\n GT(exibble)\n .fmt_currency(\n columns=\"currency\",\n decimals=3,\n use_seps=False\n )\n)\n\n\n\n\n\n\n\n num\n char\n fctr\n date\n time\n datetime\n currency\n row\n group\n\n\n\n \n 0.1111\n apricot\n one\n 2015-01-15\n 13:35\n 2018-01-01 02:22\n $49.950\n row_1\n grp_a\n \n \n 2.222\n banana\n two\n 2015-02-15\n 14:40\n 2018-02-02 14:33\n $17.950\n row_2\n grp_a\n \n \n 33.33\n coconut\n three\n 2015-03-15\n 15:45\n 2018-03-03 03:44\n $1.390\n row_3\n grp_a\n \n \n 444.4\n durian\n four\n 2015-04-15\n 16:50\n 2018-04-04 15:55\n $65100.000\n row_4\n grp_a\n \n \n 5550.0\n \n five\n 2015-05-15\n 17:55\n 2018-05-05 04:00\n $1325.810\n row_5\n grp_b\n \n \n \n fig\n six\n 2015-06-15\n \n 2018-06-06 16:11\n $13.255\n row_6\n grp_b\n \n \n 777000.0\n grapefruit\n seven\n \n 19:10\n 2018-07-07 05:22\n \n row_7\n grp_b\n \n \n 8880000.0\n honeydew\n eight\n 2015-08-15\n 20:20\n \n $0.440\n row_8\n grp_b\n \n\n\n\n\n\n\n \n\n\n\n\nSee Also\nThe functional version of this method, val_fmt_currency(), allows you to format a single numerical value (or a list of them).\n\n\n\nfmt_date\nGT.fmt_date(self, columns=None, rows=None, date_style='iso', pattern='{x}', locale=None)\nFormat values as dates.\nFormat input values to time values using one of 17 preset date styles. Input can be in the form of date type or as a ISO-8601 string (in the form of YYYY-MM-DD HH:MM:SS or YYYY-MM-DD).\n\nParameters\n\n\n\n\n\n\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\ncolumns\nSelectExpr\nThe columns to target. Can either be a single column name or a series of column names provided in a list.\nNone\n\n\nrows\nint | list[int] | None\nIn conjunction with columns=, we can specify which of their rows should undergo formatting. The default is all rows, resulting in all rows in targeted columns being formatted. Alternatively, we can supply a list of row indices.\nNone\n\n\ndate_style\nDateStyle\nThe date style to use. By default this is the short name \"iso\" which corresponds to ISO 8601 date formatting. There are 41 date styles in total and their short names can be viewed using info_date_style().\n'iso'\n\n\npattern\nstr\nA formatting pattern that allows for decoration of the formatted value. The formatted value is represented by the {x} (which can be used multiple times, if needed) and all other characters will be interpreted as string literals.\n'{x}'\n\n\nlocale\nstr | None\nAn optional locale identifier that can be used for formatting values according the locale’s rules. Examples include \"en\" for English (United States) and \"fr\" for French (France).\nNone\n\n\n\n\n\nFormatting With The Date_Style Argument\nWe need to supply a preset date style to the date_style argument. The date styles are numerous and can handle localization to any supported locale. The following table provides a listing of all date styles and their output values (corresponding to an input date of 2000-02-29).\n\n\n\n\nDate Style\nOutput\n\n\n\n\n1\n\"iso\"\n\"2000-02-29\"\n\n\n2\n\"wday_month_day_year\"\n\"Tuesday, February 29, 2000\"\n\n\n3\n\"wd_m_day_year\"\n\"Tue, Feb 29, 2000\"\n\n\n4\n\"wday_day_month_year\"\n\"Tuesday 29 February 2000\"\n\n\n5\n\"month_day_year\"\n\"February 29, 2000\"\n\n\n6\n\"m_day_year\"\n\"Feb 29, 2000\"\n\n\n7\n\"day_m_year\"\n\"29 Feb 2000\"\n\n\n8\n\"day_month_year\"\n\"29 February 2000\"\n\n\n9\n\"day_month\"\n\"29 February\"\n\n\n10\n\"day_m\"\n\"29 Feb\"\n\n\n11\n\"year\"\n\"2000\"\n\n\n12\n\"month\"\n\"February\"\n\n\n13\n\"day\"\n\"29\"\n\n\n14\n\"year.mn.day\"\n\"2000/02/29\"\n\n\n15\n\"y.mn.day\"\n\"00/02/29\"\n\n\n16\n\"year_week\"\n\"2000-W09\"\n\n\n17\n\"year_quarter\"\n\"2000-Q1\"\n\n\n\nWe can use the info_date_style() function within the console to view a similar table of date styles with example output.\n\n\nReturns\n\n\n\nType\nDescription\n\n\n\n\nGT\nThe GT object is returned. This is the same object that the method is called on so that we can facilitate method chaining.\n\n\n\n\n\nAdapting Output To A Specific Locale\nThis formatting method can adapt outputs according to a provided locale value. Examples include \"en\" for English (United States) and \"fr\" for French (France). Note that a locale value provided here will override any global locale setting performed in GT()’s own locale argument (it is settable there as a value received by all other methods that have a locale argument).\n\n\nExamples\nLet’s use the exibble dataset to create a simple, two-column table (keeping only the date and time columns). With the fmt_date() method, we’ll format the date column to display dates formatted with the \"month_day_year\" date style.\n\nfrom great_tables import GT, exibble\n\nexibble_mini = exibble[[\"date\", \"time\"]]\n\n(\n GT(exibble_mini)\n .fmt_date(columns=\"date\", date_style=\"month_day_year\")\n)\n\n\n\n\n\n\n\n date\n time\n\n\n\n \n January 15, 2015\n 13:35\n \n \n February 15, 2015\n 14:40\n \n \n March 15, 2015\n 15:45\n \n \n April 15, 2015\n 16:50\n \n \n May 15, 2015\n 17:55\n \n \n June 15, 2015\n \n \n \n \n 19:10\n \n \n August 15, 2015\n 20:20\n \n\n\n\n\n\n\n \n\n\n\n\nSee Also\nThe functional version of this method, val_fmt_date(), allows you to format a single numerical value (or a list of them).\n\n\n\nfmt_datetime\nGT.fmt_datetime(self, columns=None, rows=None, date_style='iso', time_style='iso', sep=' ', pattern='{x}', locale=None)\nFormat values as datetimes.\nFormat input values to datetime values using one of 17 preset date styles and one of 5 preset time styles. Input can be in the form of datetime values, or strings in the ISO 8601 forms of YYYY-MM-DD HH:MM:SS or YYYY-MM-DD.\n\nParameters\n\n\n\n\n\n\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\ncolumns\nSelectExpr\nThe columns to target. Can either be a single column name or a series of column names provided in a list.\nNone\n\n\nrows\nint | list[int] | None\nIn conjunction with columns=, we can specify which of their rows should undergo formatting. The default is all rows, resulting in all rows in targeted columns being formatted. Alternatively, we can supply a list of row indices.\nNone\n\n\ndate_style\nDateStyle\nThe date style to use. By default this is the short name \"iso\" which corresponds to ISO 8601 date formatting. There are 41 date styles in total and their short names can be viewed using info_date_style().\n'iso'\n\n\ntime_style\nTimeStyle\nThe time style to use. By default this is the short name \"iso\" which corresponds to how times are formatted within ISO 8601 datetime values. There are 5 time styles in total and their short names can be viewed using info_time_style().\n'iso'\n\n\n\n\n\nFormatting With The Date_Style And Time_Style Arguments\nWe need to supply a preset date style to the date_style argument and a preset time style to the time_style argument. The date styles are numerous and can handle localization to any supported locale. The following table provides a listing of all date styles and their output values (corresponding to an input date of 2000-02-29 14:35:00).\n\n\n\n\nDate Style\nOutput\n\n\n\n\n1\n\"iso\"\n\"2000-02-29\"\n\n\n2\n\"wday_month_day_year\"\n\"Tuesday, February 29, 2000\"\n\n\n3\n\"wd_m_day_year\"\n\"Tue, Feb 29, 2000\"\n\n\n4\n\"wday_day_month_year\"\n\"Tuesday 29 February 2000\"\n\n\n5\n\"month_day_year\"\n\"February 29, 2000\"\n\n\n6\n\"m_day_year\"\n\"Feb 29, 2000\"\n\n\n7\n\"day_m_year\"\n\"29 Feb 2000\"\n\n\n8\n\"day_month_year\"\n\"29 February 2000\"\n\n\n9\n\"day_month\"\n\"29 February\"\n\n\n10\n\"day_m\"\n\"29 Feb\"\n\n\n11\n\"year\"\n\"2000\"\n\n\n12\n\"month\"\n\"February\"\n\n\n13\n\"day\"\n\"29\"\n\n\n14\n\"year.mn.day\"\n\"2000/02/29\"\n\n\n15\n\"y.mn.day\"\n\"00/02/29\"\n\n\n16\n\"year_week\"\n\"2000-W09\"\n\n\n17\n\"year_quarter\"\n\"2000-Q1\"\n\n\n\nThe time styles are numerous and can handle localization to any supported locale. The following table provides a listing of all time styles and their output values (corresponding to an input time of 2000-02-29 14:35:00).\n\n\n\n\nTime Style\nOutput\nNotes\n\n\n\n\n1\n\"iso\"\n\"14:35:00\"\nISO 8601, 24h\n\n\n2\n\"iso-short\"\n\"14:35\"\nISO 8601, 24h\n\n\n3\n\"h_m_s_p\"\n\"2:35:00 PM\"\n12h\n\n\n4\n\"h_m_p\"\n\"2:35 PM\"\n12h\n\n\n5\n\"h_p\"\n\"2 PM\"\n12h\n\n\n\nWe can use the info_date_style() and info_time_style() functions within the console to view similar tables of date and time styles with example output.\n\n\nReturns\n\n\n\nType\nDescription\n\n\n\n\nGT\nThe GT object is returned. This is the same object that the method is called on so that we can facilitate method chaining.\n\n\n\n\n\nExamples\nLet’s use the exibble dataset to create a simple, two-column table (keeping only the date and time columns). With the fmt_datetime() method, we’ll format the date column to display dates formatted with the \"month_day_year\" date style and the time column to display times formatted with the \"h_m_s_p\" time style.\n\nfrom great_tables import GT, exibble\n\nexibble_mini = exibble[[\"date\", \"time\"]]\n\n(\n GT(exibble_mini)\n .fmt_datetime(\n columns=\"date\",\n date_style=\"month_day_year\",\n time_style=\"h_m_s_p\"\n )\n)\n\n\n\n\n\n\n\n date\n time\n\n\n\n \n January 15, 2015 12:00:00 AM\n 13:35\n \n \n February 15, 2015 12:00:00 AM\n 14:40\n \n \n March 15, 2015 12:00:00 AM\n 15:45\n \n \n April 15, 2015 12:00:00 AM\n 16:50\n \n \n May 15, 2015 12:00:00 AM\n 17:55\n \n \n June 15, 2015 12:00:00 AM\n \n \n \n \n 19:10\n \n \n August 15, 2015 12:00:00 AM\n 20:20\n \n\n\n\n\n\n\n \n\n\n\n\n\nfmt_image\nGT.fmt_image(self, columns=None, rows=None, height=None, width=None, sep=' ', path=None, file_pattern='{}', encode=True)\nFormat image paths to generate images in cells.\nTo more easily insert graphics into body cells, we can use the fmt_image() method. This allows for one or more images to be placed in the targeted cells. The cells need to contain some reference to an image file, either: (1) complete http/https or local paths to the files; (2) the file names, where a common path can be provided via path=; or (3) a fragment of the file name, where the file_pattern= argument helps to compose the entire file name and path= provides the path information. This should be expressly used on columns that contain only references to image files (i.e., no image references as part of a larger block of text). Multiple images can be included per cell by separating image references by commas. The sep= argument allows for a common separator to be applied between images.\n\nParameters\n\n\n\n\n\n\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\ncolumns\nSelectExpr\nThe columns to target. Can either be a single column name or a series of column names provided in a list.\nNone\n\n\nrows\nint | list[int] | None\nIn conjunction with columns=, we can specify which of their rows should undergo formatting. The default is all rows, resulting in all rows in targeted columns being formatted. Alternatively, we can supply a list of row indices.\nNone\n\n\nheight\nstr | int | None\nThe height of the rendered images.\nNone\n\n\nwidth\nstr | int | None\nThe width of the rendered images.\nNone\n\n\nsep\nstr\nIn the output of images within a body cell, sep= provides the separator between each image.\n' '\n\n\npath\nstr | Path | None\nAn optional path to local image files (this is combined with all filenames).\nNone\n\n\nfile_pattern\nstr\nThe pattern to use for mapping input values in the body cells to the names of the graphics files. The string supplied should use \"{}\" in the pattern to map filename fragments to input strings.\n'{}'\n\n\nencode\nbool\nThe option to always use Base64 encoding for image paths that are determined to be local. By default, this is True.\nTrue\n\n\n\n\n\nReturns\n\n\n\nType\nDescription\n\n\n\n\nGT\nThe GT object is returned. This is the same object that the method is called on so that we can facilitate method chaining.\n\n\n\n\n\nExamples\nUsing a small portion of metro dataset, let’s create a new table. We will only include a few columns and rows from that table. The lines column has comma-separated listings of numbers corresponding to lines served at each station. We have a directory of SVG graphics for all of these lines in the package (the path for the image directory can be accessed via files(\"great_tables\") / \"data/metro_images\", using the importlib_resources package). The filenames roughly corresponds to the data in the lines column. The fmt_image() method can be used with these inputs since the path= and file_pattern= arguments allow us to compose complete and valid file locations. What you get from this are sequences of images in the table cells, taken from the referenced graphics files on disk.\n\nfrom great_tables import GT\nfrom great_tables.data import metro\nfrom importlib_resources import files\n\nimg_paths = files(\"great_tables\") / \"data/metro_images\"\n\nmetro_mini = metro[[\"name\", \"lines\", \"passengers\"]].head(5)\n\n(\n GT(metro_mini)\n .fmt_image(\n columns=\"lines\",\n path=img_paths,\n file_pattern=\"metro_{}.svg\"\n )\n .fmt_integer(columns=\"passengers\")\n)\n\n\n\n\n\n\n\n name\n lines\n passengers\n\n\n\n \n Argentine\n \n 2,079,212\n \n \n Bastille\n \n 8,069,243\n \n \n Bérault\n \n 2,106,827\n \n \n Champs-Élysées—Clemenceau\n \n 1,909,005\n \n \n Charles de Gaulle—Étoile\n \n 4,291,663\n \n\n\n\n\n\n\n \n\n\n\n\n\nfmt_integer\nGT.fmt_integer(self, columns=None, rows=None, use_seps=True, scale_by=1, compact=False, pattern='{x}', sep_mark=',', force_sign=False, locale=None)\nFormat values as integers.\nWith numeric values in one or more table columns, we can perform number-based formatting so that the targeted values are always rendered as integer values.\nWe can have fine control over integer formatting with the following options:\n\ndigit grouping separators: options to enable/disable digit separators and provide a choice of separator symbol\nscaling: we can choose to scale targeted values by a multiplier value\nlarge-number suffixing: larger figures (thousands, millions, etc.) can be autoscaled and decorated with the appropriate suffixes\npattern: option to use a text pattern for decoration of the formatted values\nlocale-based formatting: providing a locale ID will result in number formatting specific to the chosen locale\n\n\nParameters\n\n\n\n\n\n\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\ncolumns\nSelectExpr\nThe columns to target. Can either be a single column name or a series of column names provided in a list.\nNone\n\n\nrows\nint | list[int] | None\nIn conjunction with columns=, we can specify which of their rows should undergo formatting. The default is all rows, resulting in all rows in targeted columns being formatted. Alternatively, we can supply a list of row indices.\nNone\n\n\nuse_seps\nbool\nThe use_seps option allows for the use of digit group separators. The type of digit group separator is set by sep_mark and overridden if a locale ID is provided to locale. This setting is True by default.\nTrue\n\n\nscale_by\nfloat\nAll numeric values will be multiplied by the scale_by value before undergoing formatting. Since the default value is 1, no values will be changed unless a different multiplier value is supplied.\n1\n\n\ncompact\nbool\nA boolean value that allows for compact formatting of numeric values. Values will be scaled and decorated with the appropriate suffixes (e.g., 1230 becomes 1K, and 1230000 becomes 1M). The compact option is False by default.\nFalse\n\n\npattern\nstr\nA formatting pattern that allows for decoration of the formatted value. The formatted value is represented by the {x} (which can be used multiple times, if needed) and all other characters will be interpreted as string literals.\n'{x}'\n\n\nsep_mark\nstr\nThe string to use as a separator between groups of digits. For example, using sep_mark=\",\" with a value of 1000 would result in a formatted value of \"1,000\". This argument is ignored if a locale is supplied (i.e., is not None).\n','\n\n\nforce_sign\nbool\nShould the positive sign be shown for positive values (effectively showing a sign for all values except zero)? If so, use True for this option. The default is False, where only negative numbers will display a minus sign.\nFalse\n\n\nlocale\nstr | None\nAn optional locale identifier that can be used for formatting values according the locale’s rules. Examples include \"en\" for English (United States) and \"fr\" for French (France).\nNone\n\n\n\n\n\nReturns\n\n\n\nType\nDescription\n\n\n\n\nGT\nThe GT object is returned. This is the same object that the method is called on so that we can facilitate method chaining.\n\n\n\n\n\nAdapting Output To A Specific Locale\nThis formatting method can adapt outputs according to a provided locale value. Examples include \"en\" for English (United States) and \"fr\" for French (France). The use of a valid locale ID here means separator marks will be correct for the given locale. Should any value be provided in sep_mark, it will be overridden by the locale’s preferred value.\nNote that a locale value provided here will override any global locale setting performed in GT()’s own locale argument (it is settable there as a value received by all other methods that have a locale argument).\n\n\nExamples\nFor this example, we’ll use the exibble dataset as the input table. With the fmt_integer() method, we’ll format the num column as integer values having no digit separators (with the use_seps=False option).\n\nfrom great_tables import GT, exibble\n\n(\n GT(exibble)\n .fmt_integer(columns=\"num\", use_seps=False)\n)\n\n\n\n\n\n\n\n num\n char\n fctr\n date\n time\n datetime\n currency\n row\n group\n\n\n\n \n 0\n apricot\n one\n 2015-01-15\n 13:35\n 2018-01-01 02:22\n 49.95\n row_1\n grp_a\n \n \n 2\n banana\n two\n 2015-02-15\n 14:40\n 2018-02-02 14:33\n 17.95\n row_2\n grp_a\n \n \n 33\n coconut\n three\n 2015-03-15\n 15:45\n 2018-03-03 03:44\n 1.39\n row_3\n grp_a\n \n \n 444\n durian\n four\n 2015-04-15\n 16:50\n 2018-04-04 15:55\n 65100.0\n row_4\n grp_a\n \n \n 5550\n \n five\n 2015-05-15\n 17:55\n 2018-05-05 04:00\n 1325.81\n row_5\n grp_b\n \n \n \n fig\n six\n 2015-06-15\n \n 2018-06-06 16:11\n 13.255\n row_6\n grp_b\n \n \n 777000\n grapefruit\n seven\n \n 19:10\n 2018-07-07 05:22\n \n row_7\n grp_b\n \n \n 8880000\n honeydew\n eight\n 2015-08-15\n 20:20\n \n 0.44\n row_8\n grp_b\n \n\n\n\n\n\n\n \n\n\n\n\nSee Also\nThe fmt_number() method might be more of what you need if you’d like decimal values in your outputs. Need to do integer-based formatting on a value or list of values? Take a look at the functional version of this method: val_fmt_integer().\n\n\n\nfmt_markdown\nGT.fmt_markdown(self, columns=None, rows=None)\nFormat Markdown text.\nAny Markdown-formatted text in the incoming cells will be transformed during render when using the fmt_markdown() method.\n\nParameters\n\n\n\n\n\n\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\ncolumns\nSelectExpr\nThe columns to target. Can either be a single column name or a series of column names provided in a list.\nNone\n\n\nrows\nint | list[int] | None\nIn conjunction with columns=, we can specify which of their rows should undergo formatting. The default is all rows, resulting in all rows in targeted columns being formatted. Alternatively, we can supply a list of row indices.\nNone\n\n\n\n\n\nReturns\n\n\n\nType\nDescription\n\n\n\n\nGT\nThe GT object is returned. This is the same object that the method is called on so that we can facilitate method chaining.\n\n\n\n\n\nExamples:\nLet’s first create a DataFrame containing some text that is Markdown-formatted and then introduce that to GT(). We’ll then transform the md column with the fmt_markdown() method.\n\nimport pandas as pd\nfrom great_tables import GT\nfrom great_tables.data import towny\n\ntext_1 = \"\"\"\n### This is Markdown.\n\nMarkdown’s syntax is comprised entirely of\npunctuation characters, which punctuation\ncharacters have been carefully chosen so as\nto look like what they mean... assuming\nyou’ve ever used email.\n\"\"\"\n\ntext_2 = \"\"\"\nInfo on Markdown syntax can be found\n[here](https://daringfireball.net/projects/markdown/).\n\"\"\"\n\ndf = pd.DataFrame({\"md\": [text_1, text_2]})\n\n(GT(df).fmt_markdown(\"md\"))\n\n\n\n\n\n\n\n md\n\n\n\n \n This is Markdown.\nMarkdown’s syntax is comprised entirely of\npunctuation characters, which punctuation\ncharacters have been carefully chosen so as\nto look like what they mean... assuming\nyou’ve ever used email.\n \n \n Info on Markdown syntax can be found\nhere.\n \n\n\n\n\n\n\n \n\n\n\n\nSee Also\nThe functional version of this method, val_fmt_markdown(), allows you to format a single string value (or a list of them).\n\n\n\nfmt_nanoplot\nGT.fmt_nanoplot(self, columns=None, rows=None, plot_type='line', plot_height='2em', missing_vals='marker', autoscale=False, reference_line=None, reference_area=None, expand_x=None, expand_y=None, options=None)\nFormat data for nanoplot visualizations.\nThe fmt_nanoplot() method is used to format data for nanoplot visualizations. This method allows for the creation of a variety of different plot types, including line, bar, and scatter plots.\n\n\n\n\n\n\nWarning\n\n\n\nfmt_nanoplot() is still experimental.\n\n\n\nParameters\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\ncolumns\nstr | None\nThe columns to target. Can either be a single column name or a series of column names provided in a list.\nNone\n\n\nrows\nint | list[int] | None\nIn conjunction with columns=, we can specify which of their rows should undergo formatting. The default is all rows, resulting in all rows in targeted columns being formatted. Alternatively, we can supply a list of row indices.\nNone\n\n\nplot_type\nPlotType\nNanoplots can either take the form of a line plot (using \"line\") or a bar plot (with \"bar\"). A line plot, by default, contains layers for a data line, data points, and a data area. With a bar plot, the always visible layer is that of the data bars.\n'line'\n\n\nplot_height\nstr\nThe height of the nanoplots. The default here is a sensible value of \"2em\".\n'2em'\n\n\nmissing_vals\nMissingVals\nIf missing values are encountered within the input data, there are three strategies available for their handling: (1) \"gap\" will show data gaps at the sites of missing data, where data lines will have discontinuities and bar plots will have missing bars; (2) \"marker\" will behave like \"gap\" but show prominent visual marks at the missing data locations; (3) \"zero\" will replace missing values with zero values; and (4) \"remove\" will remove any incoming missing values.\n'marker'\n\n\nautoscale\nbool\nUsing autoscale=True will ensure that the bounds of all nanoplots produced are based on the limits of data combined from all input rows. This will result in a shared scale across all of the nanoplots (for y- and x-axis data), which is useful in those cases where the nanoplot data should be compared across rows.\nFalse\n\n\nreference_line\nstr | int | float | None\nA reference line requires a single input to define the line. It could be a numeric value, applied to all nanoplots generated. Or, the input can be one of the following for generating the line from the underlying data: (1) \"mean\", (2) \"median\", (3) \"min\", (4) \"max\", (5) \"q1\", (6) \"q3\", (7) \"first\", or (8) \"last\".\nNone\n\n\nreference_area\nlist[Any] | None\nA reference area requires a list of two values for defining bottom and top boundaries (in the y direction) for a rectangular area. The types of values supplied are the same as those expected for reference_line=, which is either a numeric value or one of the following keywords for the generation of the value: (1) \"mean\", (2) \"median\", (3) \"min\", (4) \"max\", (5) \"q1\", (6) \"q3\", (7) \"first\", or (8) \"last\". Input can either be a vector or list with two elements.\nNone\n\n\nexpand_x\nlist[int] | list[float] | list[int | float] | None\nShould you need to have plots expand in the x direction, provide one or more values to expand_x=. Any values provided that are outside of the range of x-value data provided to the plot will result in a x-scale expansion.\nNone\n\n\nexpand_y\nlist[int] | list[float] | list[int | float] | None\nSimilar to expand_x=, one can have plots expand in the y direction. To make this happen, provide one or more values to expand_y=. If any of the provided values are outside of the range of y-value data provided, the plot will result in a y-scale expansion.\nNone\n\n\noptions\ndict[str, Any] | None\nBy using the nanoplot_options() helper function here, you can alter the layout and styling of the nanoplots in the new column.\nNone\n\n\n\n\n\nReturns\n\n\n\nType\nDescription\n\n\n\n\nGT\nThe GT object is returned. This is the same object that the method is called on so that we can facilitate method chaining.\n\n\n\n\n\nDetails\nNanoplots try to show individual data with reasonably good visibility. Interactivity is included as a basic feature so one can hover over the data points and vertical guides will display the value ascribed to each data point. Because Great Tables knows all about numeric formatting, values will be compactly formatted so as to not take up valuable real estate.\nWhile basic customization options are present in fmt_nanoplot(), many more opportunities for customizing nanoplots on a more granular level are possible with the aforementioned nanoplot_options() helper function. With that, layers of the nanoplots can be selectively removed and the aesthetics of the remaining plot components can be modified.\n\n\nExamples\nLet’s create a nanoplot from a Polars DataFrame containing multiple numbers per cell. The numbers are represented here as strings, where spaces separate the values, and the same values are present in two columns: lines and bars. We will use the fmt_nanoplot() method twice to create a line plot and a bar plot from the data in their respective columns.\n\nfrom great_tables import GT\nimport polars as pl\n\nrandom_numbers_df = pl.DataFrame(\n {\n \"i\": range(1, 5),\n \"lines\": [\n \"20 23 6 7 37 23 21 4 7 16\",\n \"2.3 6.8 9.2 2.42 3.5 12.1 5.3 3.6 7.2 3.74\",\n \"-12 -5 6 3.7 0 8 -7.4\",\n \"2 0 15 7 8 10 1 24 17 13 6\",\n ],\n }\n).with_columns(bars=pl.col(\"lines\"))\n\n(\n GT(random_numbers_df, rowname_col=\"i\")\n .fmt_nanoplot(columns=\"lines\")\n .fmt_nanoplot(columns=\"bars\", plot_type=\"bar\")\n)\n\n\n\n\n\n\n\n \n lines\n bars\n\n\n\n \n 1\n 3742023673723214716\n 3702023673723214716\n \n \n 2\n 12.12.302.306.809.202.423.5012.15.303.607.203.74\n 12.102.306.809.202.423.5012.15.303.607.203.74\n \n \n 3\n 8.00−12.0−12.0−5.006.003.7008.00−7.40\n 8.00−12.0−12.0−5.006.003.7008.00−7.40\n \n \n 4\n 2402015781012417136\n 2402015781012417136\n \n\n\n\n\n\n\n \n\n\nWe can always represent the input DataFrame in a different way (with list columns) and fmt_nanoplot() will still work. While the input data is the same as in the previous example, we’ll take the opportunity here to add a reference line and a reference area to the line plot and also to the bar plot.\n\nrandom_numbers_df = pl.DataFrame(\n {\n \"i\": range(1, 5),\n \"lines\": [\n { \"val\": [20.0, 23.0, 6.0, 7.0, 37.0, 23.0, 21.0, 4.0, 7.0, 16.0] },\n { \"val\": [2.3, 6.8, 9.2, 2.42, 3.5, 12.1, 5.3, 3.6, 7.2, 3.74] },\n { \"val\": [-12.0, -5.0, 6.0, 3.7, 0.0, 8.0, -7.4] },\n { \"val\": [2.0, 0.0, 15.0, 7.0, 8.0, 10.0, 1.0, 24.0, 17.0, 13.0, 6.0] },\n ],\n }\n).with_columns(bars=pl.col(\"lines\"))\n\n(\n GT(random_numbers_df, rowname_col=\"i\")\n .fmt_nanoplot(\n columns=\"lines\",\n reference_line=\"mean\",\n reference_area=[\"min\", \"q1\"]\n )\n .fmt_nanoplot(\n columns=\"bars\",\n plot_type=\"bar\",\n reference_line=\"max\",\n reference_area=[\"max\", \"median\"])\n)\n\n\n\n\n\n\n\n \n lines\n bars\n\n\n\n \n 1\n 16.43742023673723214716\n 37.03742023673723214716\n \n \n 2\n 5.6212.12.302.306.809.202.423.5012.15.303.607.203.74\n 12.112.12.302.306.809.202.423.5012.15.303.607.203.74\n \n \n 3\n −0.968.00−12.0−12.0−5.006.003.7008.00−7.40\n 8.008.00−12.0−12.0−5.006.003.7008.00−7.40\n \n \n 4\n 9.362402015781012417136\n 24.02402015781012417136\n \n\n\n\n\n\n\n \n\n\nHere’s an example to adjust some of the options using nanoplot_options().\n\nfrom great_tables import nanoplot_options\n\n(\n GT(random_numbers_df, rowname_col=\"i\")\n .fmt_nanoplot(\n columns=\"lines\",\n reference_line=\"mean\",\n reference_area=[\"min\", \"q1\"],\n options=nanoplot_options(\n data_point_radius=8,\n data_point_stroke_color=\"black\",\n data_point_stroke_width=2,\n data_point_fill_color=\"white\",\n data_line_type=\"straight\",\n data_line_stroke_color=\"brown\",\n data_line_stroke_width=2,\n data_area_fill_color=\"orange\",\n vertical_guide_stroke_color=\"green\",\n ),\n )\n .fmt_nanoplot(\n columns=\"bars\",\n plot_type=\"bar\",\n reference_line=\"max\",\n reference_area=[\"max\", \"median\"],\n options=nanoplot_options(\n data_bar_stroke_color=\"gray\",\n data_bar_stroke_width=2,\n data_bar_fill_color=\"orange\",\n data_bar_negative_stroke_color=\"blue\",\n data_bar_negative_stroke_width=1,\n data_bar_negative_fill_color=\"lightblue\",\n reference_line_color=\"pink\",\n reference_area_fill_color=\"bisque\",\n vertical_guide_stroke_color=\"blue\",\n ),\n )\n)\n\n\n\n\n\n\n\n \n lines\n bars\n\n\n\n \n 1\n 16.43742023673723214716\n 37.03742023673723214716\n \n \n 2\n 5.6212.12.302.306.809.202.423.5012.15.303.607.203.74\n 12.112.12.302.306.809.202.423.5012.15.303.607.203.74\n \n \n 3\n −0.968.00−12.0−12.0−5.006.003.7008.00−7.40\n 8.008.00−12.0−12.0−5.006.003.7008.00−7.40\n \n \n 4\n 9.362402015781012417136\n 24.02402015781012417136\n \n\n\n\n\n\n\n \n\n\nSingle-value bar plots and line plots can be made with fmt_nanoplot(). These run in the horizontal direction, which is ideal for tabular presentation. The key thing here is that fmt_nanoplot() expects a column of numeric values. These plots are meant for comparison across rows so the method automatically scales the horizontal bars to facilitate this type of display. The following example shows how fmt_nanoplot() can be used to create single-value bar and line plots.\n\nsingle_vals_df = pl.DataFrame(\n {\n \"i\": range(1, 6),\n \"bars\": [4.1, 1.3, -5.3, 0, 8.2],\n \"lines\": [12.44, 6.34, 5.2, -8.2, 9.23]\n }\n)\n(\n GT(single_vals_df, rowname_col=\"i\")\n .fmt_nanoplot(columns=\"bars\", plot_type=\"bar\")\n .fmt_nanoplot(columns=\"lines\", plot_type=\"line\")\n)\n\n\n\n\n\n\n\n \n bars\n lines\n\n\n\n \n 1\n 4.10\n 12.4\n \n \n 2\n 1.30\n 6.34\n \n \n 3\n −5.30\n 5.20\n \n \n 4\n 0\n −8.20\n \n \n 5\n 8.20\n 9.23\n \n\n\n\n\n\n\n \n\n\n\n\n\nfmt_number\nGT.fmt_number(self, columns=None, rows=None, decimals=2, n_sigfig=None, drop_trailing_zeros=False, drop_trailing_dec_mark=True, use_seps=True, scale_by=1, compact=False, pattern='{x}', sep_mark=',', dec_mark='.', force_sign=False, locale=None)\nFormat numeric values.\nWith numeric values within a table’s body cells, we can perform number-based formatting so that the targeted values are rendered with a higher consideration for tabular presentation. Furthermore, there is finer control over numeric formatting with the following options:\n\ndecimals: choice of the number of decimal places, option to drop trailing zeros, and a choice of the decimal symbol\ndigit grouping separators: options to enable/disable digit separators and provide a choice of separator symbol\nscaling: we can choose to scale targeted values by a multiplier value\nlarge-number suffixing: larger figures (thousands, millions, etc.) can be autoscaled and decorated with the appropriate suffixes\npattern: option to use a text pattern for decoration of the formatted values\nlocale-based formatting: providing a locale ID will result in number formatting specific to the chosen locale\n\n\nParameters\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\ncolumns\nSelectExpr\nThe columns to target. Can either be a single column name or a series of column names provided in a list.\nNone\n\n\nrows\nint | list[int] | None\nIn conjunction with columns=, we can specify which of their rows should undergo formatting. The default is all rows, resulting in all rows in targeted columns being formatted. Alternatively, we can supply a list of row indices.\nNone\n\n\ndecimals\nint\nThe decimals values corresponds to the exact number of decimal places to use. A value such as 2.34 can, for example, be formatted with 0 decimal places and it would result in \"2\". With 4 decimal places, the formatted value becomes \"2.3400\". The trailing zeros can be removed with drop_trailing_zeros=True. If you always need decimals = 0, the fmt_integer() method should be considered.\n2\n\n\nn_sigfig\nint | None\nA option to format numbers to n significant figures. By default, this is None and thus number values will be formatted according to the number of decimal places set via decimals. If opting to format according to the rules of significant figures, n_sigfig must be a number greater than or equal to 1. Any values passed to the decimals and drop_trailing_zeros arguments will be ignored.\nNone\n\n\ndrop_trailing_zeros\nbool\nA boolean value that allows for removal of trailing zeros (those redundant zeros after the decimal mark).\nFalse\n\n\ndrop_trailing_dec_mark\nbool\nA boolean value that determines whether decimal marks should always appear even if there are no decimal digits to display after formatting (e.g., 23 becomes 23. if False). By default trailing decimal marks are not shown.\nTrue\n\n\nuse_seps\nbool\nThe use_seps option allows for the use of digit group separators. The type of digit group separator is set by sep_mark and overridden if a locale ID is provided to locale. This setting is True by default.\nTrue\n\n\nscale_by\nfloat\nAll numeric values will be multiplied by the scale_by value before undergoing formatting. Since the default value is 1, no values will be changed unless a different multiplier value is supplied.\n1\n\n\ncompact\nbool\nA boolean value that allows for compact formatting of numeric values. Values will be scaled and decorated with the appropriate suffixes (e.g., 1230 becomes 1.23K, and 1230000 becomes 1.23M). The compact option is False by default.\nFalse\n\n\npattern\nstr\nA formatting pattern that allows for decoration of the formatted value. The formatted value is represented by the {x} (which can be used multiple times, if needed) and all other characters will be interpreted as string literals.\n'{x}'\n\n\nsep_mark\nstr\nThe string to use as a separator between groups of digits. For example, using sep_mark=\",\" with a value of 1000 would result in a formatted value of \"1,000\". This argument is ignored if a locale is supplied (i.e., is not None).\n','\n\n\ndec_mark\nstr\nThe string to be used as the decimal mark. For example, using dec_mark=\",\" with the value 0.152 would result in a formatted value of \"0,152\"). This argument is ignored if a locale is supplied (i.e., is not None).\n'.'\n\n\nforce_sign\nbool\nShould the positive sign be shown for positive values (effectively showing a sign for all values except zero)? If so, use True for this option. The default is False, where only negative numbers will display a minus sign.\nFalse\n\n\nlocale\nstr | None\nAn optional locale identifier that can be used for formatting values according the locale’s rules. Examples include \"en\" for English (United States) and \"fr\" for French (France).\nNone\n\n\n\n\n\nReturns\n\n\n\nType\nDescription\n\n\n\n\nGT\nThe GT object is returned. This is the same object that the method is called on so that we can facilitate method chaining.\n\n\n\n\n\nAdapting Output To A Specific Locale\nThis formatting method can adapt outputs according to a provided locale value. Examples include \"en\" for English (United States) and \"fr\" for French (France). The use of a valid locale ID here means separator and decimal marks will be correct for the given locale. Should any values be provided in sep_mark or dec_mark, they will be overridden by the locale’s preferred values.\nNote that a locale value provided here will override any global locale setting performed in GT()’s own locale argument (it is settable there as a value received by all other methods that have a locale argument).\n\n\nExamples\nLet’s use the exibble dataset to create a table. With the fmt_number() method, we’ll format the num column to have three decimal places (with decimals=3) and omit the use of digit separators (with use_seps=False).\n\nfrom great_tables import GT, exibble\n\n(\n GT(exibble)\n .fmt_number(columns=\"num\", decimals=3, use_seps=False)\n)\n\n\n\n\n\n\n\n num\n char\n fctr\n date\n time\n datetime\n currency\n row\n group\n\n\n\n \n 0.111\n apricot\n one\n 2015-01-15\n 13:35\n 2018-01-01 02:22\n 49.95\n row_1\n grp_a\n \n \n 2.222\n banana\n two\n 2015-02-15\n 14:40\n 2018-02-02 14:33\n 17.95\n row_2\n grp_a\n \n \n 33.330\n coconut\n three\n 2015-03-15\n 15:45\n 2018-03-03 03:44\n 1.39\n row_3\n grp_a\n \n \n 444.400\n durian\n four\n 2015-04-15\n 16:50\n 2018-04-04 15:55\n 65100.0\n row_4\n grp_a\n \n \n 5550.000\n \n five\n 2015-05-15\n 17:55\n 2018-05-05 04:00\n 1325.81\n row_5\n grp_b\n \n \n \n fig\n six\n 2015-06-15\n \n 2018-06-06 16:11\n 13.255\n row_6\n grp_b\n \n \n 777000.000\n grapefruit\n seven\n \n 19:10\n 2018-07-07 05:22\n \n row_7\n grp_b\n \n \n 8880000.000\n honeydew\n eight\n 2015-08-15\n 20:20\n \n 0.44\n row_8\n grp_b\n \n\n\n\n\n\n\n \n\n\n\n\nSee Also\nThe fmt_integer() method might be more useful if you really need to format numeric values to appear as integers (i.e., no decimals will be shown and input values are rounded as necessary). Need to do numeric formatting on a value or list of values? Take a look at the functional version of this method: val_fmt_number().\n\n\n\nfmt_percent\nGT.fmt_percent(self, columns=None, rows=None, decimals=2, drop_trailing_zeros=False, drop_trailing_dec_mark=True, scale_values=True, use_seps=True, pattern='{x}', sep_mark=',', dec_mark='.', force_sign=False, placement='right', incl_space=False, locale=None)\nFormat values as a percentage.\nWith numeric values in a gt table, we can perform percentage-based formatting. It is assumed the input numeric values are proportional values and, in this case, the values will be automatically multiplied by 100 before decorating with a percent sign (the other case is accommodated though setting scale_values to False). For more control over percentage formatting, we can use the following options:\n\npercent sign placement: the percent sign can be placed after or before the values and a space can be inserted between the symbol and the value.\ndecimals: choice of the number of decimal places, option to drop trailing zeros, and a choice of the decimal symbol\ndigit grouping separators: options to enable/disable digit separators and provide a choice of separator symbol\nvalue scaling toggle: choose to disable automatic value scaling in the situation that values are already scaled coming in (and just require the percent symbol)\npattern: option to use a text pattern for decoration of the formatted values\nlocale-based formatting: providing a locale ID will result in number formatting specific to the chosen locale\n\n\nParameters\n\n\n\n\n\n\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\ncolumns\nSelectExpr\nThe columns to target. Can either be a single column name or a series of column names provided in a list.\nNone\n\n\nrows\nint | list[int] | None\nIn conjunction with columns=, we can specify which of their rows should undergo formatting. The default is all rows, resulting in all rows in targeted columns being formatted. Alternatively, we can supply a list of row indices.\nNone\n\n\ndecimals\nint\nThe decimals values corresponds to the exact number of decimal places to use. A value such as 2.34 can, for example, be formatted with 0 decimal places and it would result in \"2\". With 4 decimal places, the formatted value becomes \"2.3400\". The trailing zeros can be removed with drop_trailing_zeros=True.\n2\n\n\ndrop_trailing_zeros\nbool\nA boolean value that allows for removal of trailing zeros (those redundant zeros after the decimal mark).\nFalse\n\n\ndrop_trailing_dec_mark\nbool\nA boolean value that determines whether decimal marks should always appear even if there are no decimal digits to display after formatting (e.g., 23 becomes 23. if False). By default trailing decimal marks are not shown.\nTrue\n\n\nscale_values\nbool\nShould the values be scaled through multiplication by 100? By default this scaling is performed since the expectation is that incoming values are usually proportional. Setting to False signifies that the values are already scaled and require only the percent sign when formatted.\nTrue\n\n\nuse_seps\nbool\nThe use_seps option allows for the use of digit group separators. The type of digit group separator is set by sep_mark and overridden if a locale ID is provided to locale. This setting is True by default.\nTrue\n\n\npattern\nstr\nA formatting pattern that allows for decoration of the formatted value. The formatted value is represented by the {x} (which can be used multiple times, if needed) and all other characters will be interpreted as string literals.\n'{x}'\n\n\nsep_mark\nstr\nThe string to use as a separator between groups of digits. For example, using sep_mark=\",\" with a value of 1000 would result in a formatted value of \"1,000\". This argument is ignored if a locale is supplied (i.e., is not None).\n','\n\n\ndec_mark\nstr\nThe string to be used as the decimal mark. For example, using dec_mark=\",\" with the value 0.152 would result in a formatted value of \"0,152\"). This argument is ignored if a locale is supplied (i.e., is not None).\n'.'\n\n\nforce_sign\nbool\nShould the positive sign be shown for positive values (effectively showing a sign for all values except zero)? If so, use True for this option. The default is False, where only negative numbers will display a minus sign.\nFalse\n\n\nplacement\nstr\nThis option governs the placement of the percent sign. This can be either be \"right\" (the default) or \"left\".\n'right'\n\n\nincl_space\nbool\nAn option for whether to include a space between the value and the percent sign. The default is to not introduce a space character.\nFalse\n\n\nlocale\nstr | None\nAn optional locale identifier that can be used for formatting values according the locale’s rules. Examples include \"en\" for English (United States) and \"fr\" for French (France).\nNone\n\n\n\n\n\nReturns\n\n\n\nType\nDescription\n\n\n\n\nGT\nThe GT object is returned. This is the same object that the method is called on so that we can facilitate method chaining.\n\n\n\n\n\nAdapting Output To A Specific Locale\nThis formatting method can adapt outputs according to a provided locale value. Examples include \"en\" for English (United States) and \"fr\" for French (France). The use of a valid locale ID here means separator and decimal marks will be correct for the given locale. Should any values be provided in sep_mark or dec_mark, they will be overridden by the locale’s preferred values.\nNote that a locale value provided here will override any global locale setting performed in GT()’s own locale argument (it is settable there as a value received by all other methods that have a locale argument).\n\n\nExamples\nLet’s use the towny dataset as the input table. With the fmt_percent() method, we’ll format the pop_change_2016_2021_pct column to to display values as percentages (to two decimal places).\n\nfrom great_tables import GT\nfrom great_tables.data import towny\n\ntowny_mini = (\n towny[[\"name\", \"pop_change_2016_2021_pct\"]]\n .head(10)\n)\n\n(GT(towny_mini).fmt_percent(\"pop_change_2016_2021_pct\", decimals=2))\n\n\n\n\n\n\n\n name\n pop_change_2016_2021_pct\n\n\n\n \n Addington Highlands\n 9.32%\n \n \n Adelaide Metcalfe\n 0.70%\n \n \n Adjala-Tosorontio\n 0.13%\n \n \n Admaston/Bromley\n 2.04%\n \n \n Ajax\n 5.84%\n \n \n Alberton\n −1.55%\n \n \n Alfred and Plantagenet\n 2.78%\n \n \n Algonquin Highlands\n 10.08%\n \n \n Alnwick/Haldimand\n 8.79%\n \n \n Amaranth\n 6.08%\n \n\n\n\n\n\n\n \n\n\n\n\nSee Also\nThe functional version of this method, val_fmt_percent(), allows you to format a single numerical value (or a list of them).\n\n\n\nfmt_roman\nGT.fmt_roman(self, columns=None, rows=None, case='upper', pattern='{x}')\nFormat values as Roman numerals.\nWith numeric values in a gt table we can transform those to Roman numerals, rounding values as necessary.\n\nParameters\n\n\n\n\n\n\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\ncolumns\nSelectExpr\nThe columns to target. Can either be a single column name or a series of column names provided in a list.\nNone\n\n\nrows\nint | list[int] | None\nIn conjunction with columns=, we can specify which of their rows should undergo formatting. The default is all rows, resulting in all rows in targeted columns being formatted. Alternatively, we can supply a list of row indices.\nNone\n\n\ncase\nstr\nShould Roman numerals should be rendered as uppercase (\"upper\") or lowercase (\"lower\") letters? By default, this is set to \"upper\".\n'upper'\n\n\npattern\nstr\nA formatting pattern that allows for decoration of the formatted value. The formatted value is represented by the {x} (which can be used multiple times, if needed) and all other characters will be interpreted as string literals.\n'{x}'\n\n\n\n\n\nReturns\n\n\n\nType\nDescription\n\n\n\n\nGT\nThe GT object is returned. This is the same object that the method is called on so that we can facilitate method chaining.\n\n\n\n\n\nExamples\nLet’s first create a DataFrame containing small numeric values and then introduce that to GT(). We’ll then format the roman column to appear as Roman numerals with the fmt_roman() method.\n\nimport pandas as pd\nfrom great_tables import GT\n\nnumbers_tbl = pd.DataFrame({\"arabic\": [1, 8, 24, 85], \"roman\": [1, 8, 24, 85]})\n\n(\n GT(numbers_tbl, rowname_col=\"arabic\")\n .fmt_roman(columns=\"roman\")\n)\n\n\n\n\n\n\n\n \n roman\n\n\n\n \n 1\n I\n \n \n 8\n VIII\n \n \n 24\n XXIV\n \n \n 85\n LXXXV\n \n\n\n\n\n\n\n \n\n\n\n\nSee Also\nThe functional version of this method, val_fmt_roman(), allows you to format a single numerical value (or a list of them).\n\n\n\nfmt_scientific\nGT.fmt_scientific(self, columns=None, rows=None, decimals=2, n_sigfig=None, drop_trailing_zeros=False, drop_trailing_dec_mark=True, scale_by=1, exp_style='x10n', pattern='{x}', sep_mark=',', dec_mark='.', force_sign_m=False, force_sign_n=False, locale=None)\nFormat values to scientific notation.\nWith numeric values in a table, we can perform formatting so that the targeted values are rendered in scientific notation, where extremely large or very small numbers can be expressed in a more practical fashion. Here, numbers are written in the form of a mantissa (m) and an exponent (n) with the construction m x 10^n or mEn. The mantissa component is a number between 1 and 10. For instance, 2.5 x 10^9 can be used to represent the value 2,500,000,000 in scientific notation. In a similar way, 0.00000012 can be expressed as 1.2 x 10^-7. Due to its ability to describe numbers more succinctly and its ease of calculation, scientific notation is widely employed in scientific and technical domains.\nWe have fine control over the formatting task, with the following options:\n\ndecimals: choice of the number of decimal places, option to drop trailing zeros, and a choice of the decimal symbol\nscaling: we can choose to scale targeted values by a multiplier value\npattern: option to use a text pattern for decoration of the formatted values\nlocale-based formatting: providing a locale ID will result in formatting specific to the chosen locale\n\n\nParameters\n\n\n\n\n\n\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\ncolumns\nSelectExpr\nThe columns to target. Can either be a single column name or a series of column names provided in a list.\nNone\n\n\nrows\nint | list[int] | None\nIn conjunction with columns=, we can specify which of their rows should undergo formatting. The default is all rows, resulting in all rows in targeted columns being formatted. Alternatively, we can supply a list of row indices.\nNone\n\n\ndecimals\nint\nThe decimals values corresponds to the exact number of decimal places to use. A value such as 2.34 can, for example, be formatted with 0 decimal places and it would result in \"2\". With 4 decimal places, the formatted value becomes \"2.3400\". The trailing zeros can be removed with drop_trailing_zeros=True.\n2\n\n\nn_sigfig\nint | None\nA option to format numbers to n significant figures. By default, this is None and thus number values will be formatted according to the number of decimal places set via decimals. If opting to format according to the rules of significant figures, n_sigfig must be a number greater than or equal to 1. Any values passed to the decimals and drop_trailing_zeros arguments will be ignored.\nNone\n\n\ndrop_trailing_zeros\nbool\nA boolean value that allows for removal of trailing zeros (those redundant zeros after the decimal mark).\nFalse\n\n\ndrop_trailing_dec_mark\nbool\nA boolean value that determines whether decimal marks should always appear even if there are no decimal digits to display after formatting (e.g., 23 becomes 23. if False). By default trailing decimal marks are not shown.\nTrue\n\n\nscale_by\nfloat\nAll numeric values will be multiplied by the scale_by value before undergoing formatting. Since the default value is 1, no values will be changed unless a different multiplier value is supplied.\n1\n\n\nexp_style\nstr\nStyle of formatting to use for the scientific notation formatting. By default this is \"x10n\" but other options include using a single letter (e.g., \"e\", \"E\", etc.), a letter followed by a \"1\" to signal a minimum digit width of one, or \"low-ten\" for using a stylized \"10\" marker.\n'x10n'\n\n\npattern\nstr\nA formatting pattern that allows for decoration of the formatted value. The formatted value is represented by the {x} (which can be used multiple times, if needed) and all other characters will be interpreted as string literals.\n'{x}'\n\n\nsep_mark\nstr\nThe string to use as a separator between groups of digits. For example, using sep_mark=\",\" with a value of 1000 would result in a formatted value of \"1,000\". This argument is ignored if a locale is supplied (i.e., is not None).\n','\n\n\ndec_mark\nstr\nThe string to be used as the decimal mark. For example, using dec_mark=\",\" with the value 0.152 would result in a formatted value of \"0,152\"). This argument is ignored if a locale is supplied (i.e., is not None).\n'.'\n\n\nforce_sign_m\nbool\nShould the plus sign be shown for positive values of the mantissa (first component)? This would effectively show a sign for all values except zero on the first numeric component of the notation. If so, use True (the default for this is False), where only negative numbers will display a sign.\nFalse\n\n\nforce_sign_n\nbool\nShould the plus sign be shown for positive values of the exponent (second component)? This would effectively show a sign for all values except zero on the second numeric component of the notation. If so, use True (the default for this is False), where only negative numbers will display a sign.\nFalse\n\n\nlocale\nstr | None\nAn optional locale identifier that can be used for formatting values according the locale’s rules. Examples include \"en\" for English (United States) and \"fr\" for French (France).\nNone\n\n\n\n\n\nReturns\n\n\n\nType\nDescription\n\n\n\n\nGT\nThe GT object is returned. This is the same object that the method is called on so that we can facilitate method chaining.\n\n\n\n\n\nAdapting Output To A Specific Locale\nThis formatting method can adapt outputs according to a provided locale value. Examples include \"en\" for English (United States) and \"fr\" for French (France). The use of a valid locale ID here means separator and decimal marks will be correct for the given locale. Should any values be provided in sep_mark or dec_mark, they will be overridden by the locale’s preferred values.\nNote that a locale value provided here will override any global locale setting performed in GT()’s own locale argument (it is settable there as a value received by all other methods that have a locale argument).\n\n\nExamples\nFor this example, we’ll use the exibble dataset as the input table. With the fmt_scientific() method, we’ll format the num column to contain values in scientific formatting.\n\nfrom great_tables import GT, exibble\n\n(\n GT(exibble)\n .fmt_scientific(columns=\"num\")\n)\n\n\n\n\n\n\n\n num\n char\n fctr\n date\n time\n datetime\n currency\n row\n group\n\n\n\n \n 1.11 × 10−1\n apricot\n one\n 2015-01-15\n 13:35\n 2018-01-01 02:22\n 49.95\n row_1\n grp_a\n \n \n 2.22\n banana\n two\n 2015-02-15\n 14:40\n 2018-02-02 14:33\n 17.95\n row_2\n grp_a\n \n \n 3.33 × 101\n coconut\n three\n 2015-03-15\n 15:45\n 2018-03-03 03:44\n 1.39\n row_3\n grp_a\n \n \n 4.44 × 102\n durian\n four\n 2015-04-15\n 16:50\n 2018-04-04 15:55\n 65100.0\n row_4\n grp_a\n \n \n 5.55 × 103\n \n five\n 2015-05-15\n 17:55\n 2018-05-05 04:00\n 1325.81\n row_5\n grp_b\n \n \n \n fig\n six\n 2015-06-15\n \n 2018-06-06 16:11\n 13.255\n row_6\n grp_b\n \n \n 7.77 × 105\n grapefruit\n seven\n \n 19:10\n 2018-07-07 05:22\n \n row_7\n grp_b\n \n \n 8.88 × 106\n honeydew\n eight\n 2015-08-15\n 20:20\n \n 0.44\n row_8\n grp_b\n \n\n\n\n\n\n\n \n\n\n\n\nSee Also\nThe functional version of this method, val_fmt_scientific(), allows you to format a single numerical value (or a list of them).\n\n\n\nfmt_time\nGT.fmt_time(self, columns=None, rows=None, time_style='iso', pattern='{x}', locale=None)\nFormat values as times.\nFormat input values to time values using one of 5 preset time styles. Input can be in the form of time values, or strings in the ISO 8601 forms of HH:MM:SS or YYYY-MM-DD HH:MM:SS.\n\nParameters\n\n\n\n\n\n\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\ncolumns\nSelectExpr\nThe columns to target. Can either be a single column name or a series of column names provided in a list.\nNone\n\n\nrows\nint | list[int] | None\nIn conjunction with columns=, we can specify which of their rows should undergo formatting. The default is all rows, resulting in all rows in targeted columns being formatted. Alternatively, we can supply a list of row indices.\nNone\n\n\ntime_style\nTimeStyle\nThe time style to use. By default this is the short name \"iso\" which corresponds to how times are formatted within ISO 8601 datetime values. There are 5 time styles in total and their short names can be viewed using info_time_style().\n'iso'\n\n\npattern\nstr\nA formatting pattern that allows for decoration of the formatted value. The formatted value is represented by the {x} (which can be used multiple times, if needed) and all other characters will be interpreted as string literals.\n'{x}'\n\n\nlocale\nstr | None\nAn optional locale identifier that can be used for formatting values according the locale’s rules. Examples include \"en\" for English (United States) and \"fr\" for French (France).\nNone\n\n\n\n\n\nFormatting With The Time_Style Argument\nWe need to supply a preset time style to the time_style argument. The time styles are numerous and can handle localization to any supported locale. The following table provides a listing of all time styles and their output values (corresponding to an input time of 14:35:00).\n\n\n\n\nTime Style\nOutput\nNotes\n\n\n\n\n1\n\"iso\"\n\"14:35:00\"\nISO 8601, 24h\n\n\n2\n\"iso-short\"\n\"14:35\"\nISO 8601, 24h\n\n\n3\n\"h_m_s_p\"\n\"2:35:00 PM\"\n12h\n\n\n4\n\"h_m_p\"\n\"2:35 PM\"\n12h\n\n\n5\n\"h_p\"\n\"2 PM\"\n12h\n\n\n\nWe can use the info_time_style() function within the console to view a similar table of time styles with example output.\n\n\nReturns\n\n\n\nType\nDescription\n\n\n\n\nGT\nThe GT object is returned. This is the same object that the method is called on so that we can facilitate method chaining.\n\n\n\n\n\nAdapting Output To A Specific Locale\nThis formatting method can adapt outputs according to a provided locale value. Examples include \"en\" for English (United States) and \"fr\" for French (France). Note that a locale value provided here will override any global locale setting performed in GT()’s own locale argument (it is settable there as a value received by all other methods that have a locale argument).\n\n\nExamples\nLet’s use the exibble dataset to create a simple, two-column table (keeping only the date and time columns). With the fmt_time() method, we’ll format the time column to display times formatted with the \"h_m_s_p\" time style.\n\nfrom great_tables import GT, exibble\n\nexibble_mini = exibble[[\"date\", \"time\"]]\n\n(\n GT(exibble_mini)\n .fmt_time(columns=\"time\", time_style=\"h_m_s_p\")\n)\n\n\n\n\n\n\n\n date\n time\n\n\n\n \n 2015-01-15\n 1:35:00 PM\n \n \n 2015-02-15\n 2:40:00 PM\n \n \n 2015-03-15\n 3:45:00 PM\n \n \n 2015-04-15\n 4:50:00 PM\n \n \n 2015-05-15\n 5:55:00 PM\n \n \n 2015-06-15\n \n \n \n \n 7:10:00 PM\n \n \n 2015-08-15\n 8:20:00 PM\n \n\n\n\n\n\n\n \n\n\n\n\nSee Also\nThe functional version of this method, val_fmt_time(), allows you to format a single numerical value (or a list of them).\n\n\n\nfmt_units\nGT.fmt_units(self, columns=None, rows=None, pattern='{x}')\nFormat measurement units.\nThe fmt_units() method lets you better format measurement units in the table body. These must conform to the Great Tables units notation; as an example of this, \"J Hz^-1 mol^-1\" can be used to generate units for the molar Planck constant. The notation here provides several conveniences for defining units, so as long as the values to be formatted conform to this syntax, you’ll obtain nicely-formatted inline units. Details pertaining to units notation can be found in the section entitled How to use units notation.\n\nParameters\n\n\n\n\n\n\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\ncolumns\nSelectExpr\nThe columns to target. Can either be a single column name or a series of column names provided in a list.\nNone\n\n\nrows\nint | list[int] | None\nIn conjunction with columns=, we can specify which of their rows should undergo formatting. The default is all rows, resulting in all rows in targeted columns being formatted. Alternatively, we can supply a list of row indices.\nNone\n\n\npattern\nstr\nA formatting pattern that allows for decoration of the formatted value. The formatted value is represented by the {x} (which can be used multiple times, if needed) and all other characters will be interpreted as string literals.\n'{x}'\n\n\n\n\n\nHow To Use Units Notation\nThe Great Tables units notation involves a shorthand of writing units that feels familiar and is fine-tuned for the task at hand. Each unit is treated as a separate entity (parentheses and other symbols included) and the addition of subscript text and exponents is flexible and relatively easy to formulate. This is all best shown with examples:\n\n\"m/s\" and \"m / s\" both render as \"m/s\"\n\"m s^-1\" will appear with the \"-1\" exponent intact\n\"m /s\" gives the the same result, as \"/<unit>\" is equivalent to \"<unit>^-1\"\n\"E_h\" will render an \"E\" with the \"h\" subscript\n\"t_i^2.5\" provides a t with an \"i\" subscript and a \"2.5\" exponent\n\"m[_0^2]\" will use overstriking to set both scripts vertically\n\"g/L %C6H12O6%\" uses a chemical formula (enclosed in a pair of \"%\" characters) as a unit partial, and the formula will render correctly with subscripted numbers\nCommon units that are difficult to write using ASCII text may be implicitly converted to the correct characters (e.g., the \"u\" in \"ug\", \"um\", \"uL\", and \"umol\" will be converted to the Greek mu symbol; \"degC\" and \"degF\" will render a degree sign before the temperature unit)\nWe can transform shorthand symbol/unit names enclosed in \":\" (e.g., \":angstrom:\", \":ohm:\", etc.) into proper symbols\nGreek letters can added by enclosing the letter name in \":\"; you can use lowercase letters (e.g., \":beta:\", \":sigma:\", etc.) and uppercase letters too (e.g., \":Alpha:\", \":Zeta:\", etc.)\nThe components of a unit (unit name, subscript, and exponent) can be fully or partially italicized/emboldened by surrounding text with \"*\" or \"**\"\n\n\n\nReturns\n\n\n\nType\nDescription\n\n\n\n\nGT\nThe GT object is returned. This is the same object that the method is called on so that we can facilitate method chaining.\n\n\n\n\n\nExamples\nLet’s use the illness dataset and create a new table. The units column happens to contain string values in units notation (e.g., \"x10^9 / L\"). Using the fmt_units() method here will improve the formatting of those measurement units.\n\nfrom great_tables import GT, style, loc\nfrom great_tables.data import illness\n\n(\n GT(illness, rowname_col=\"test\")\n .fmt_units(columns=\"units\")\n .fmt_number(columns=lambda x: x.startswith(\"day\"), decimals=2, drop_trailing_zeros=True)\n .tab_header(title=\"Laboratory Findings for the YF Patient\")\n .tab_spanner(label=\"Day\", columns=lambda x: x.startswith(\"day\"))\n .tab_spanner(label=\"Normal Range\", columns=lambda x: x.startswith(\"norm\"))\n .cols_label(\n norm_l=\"Lower\",\n norm_u=\"Upper\",\n units=\"Units\"\n )\n .opt_vertical_padding(scale=0.4)\n .opt_align_table_header(align=\"left\")\n .tab_options(heading_padding=\"10px\")\n .tab_style(\n locations=loc.body(columns=\"norm_l\"),\n style=style.borders(sides=\"left\")\n )\n .opt_vertical_padding(scale=0.5)\n)\n\n\n\n\n\n\n \n Laboratory Findings for the YF Patient\n \n\n \n Units\n \n Day\n \n \n Normal Range\n \n\n\n day_3\n day_4\n day_5\n day_6\n day_7\n day_8\n day_9\n Lower\n Upper\n\n\n\n \n Viral load\n copies per mL\n 12,000\n 4,200\n 1,600\n 830\n 760\n 520\n 250\n \n \n \n \n WBC\n ×109/L\n 5.26\n 4.26\n 9.92\n 10.49\n 24.77\n 30.26\n 19.03\n 4.0\n 10.0\n \n \n Neutrophils\n ×109/L\n 4.87\n 4.72\n 7.92\n 18.21\n 22.08\n 27.17\n 16.59\n 2.0\n 8.0\n \n \n RBC\n ×1012/L\n 5.72\n 5.98\n 4.23\n 4.83\n 4.12\n 2.68\n 3.32\n 4.0\n 5.5\n \n \n Hb\n g/L\n 153\n 135\n 126\n 115\n 75\n 87\n 95\n 120.0\n 160.0\n \n \n PLT\n ×109/L\n 67\n 38.6\n 27.4\n 26.2\n 74.1\n 36.2\n 25.6\n 100.0\n 300.0\n \n \n ALT\n U/L\n 12,835\n 12,632\n 6,426.7\n 4,263.1\n 1,623.7\n 672.6\n 512.4\n 9.0\n 50.0\n \n \n AST\n U/L\n 23,672\n 21,368\n 14,730\n 8,691\n 2,189\n 1,145\n 782.5\n 15.0\n 40.0\n \n \n TBIL\n µmol/L\n 117.2\n 143.8\n 137.2\n 158.1\n 127.3\n 105.1\n 163.2\n 0.0\n 18.8\n \n \n DBIL\n µmol/L\n 71.4\n 104.6\n 94.6\n 143.9\n 117.8\n 83.6\n 126.3\n 0.0\n 6.8\n \n \n NH3\n mmol/L\n 115.2\n 135.2\n 131\n 176.7\n 84.2\n 72.4\n 91.9\n 10.0\n 47.0\n \n \n PT\n s\n 24.6\n 42.4\n 53.7\n 54\n 22.6\n 16.8\n 29.5\n 9.4\n 12.5\n \n \n APTT\n s\n 39.2\n 57.2\n 65.9\n 68.3\n 62.4\n 61.7\n 114.7\n 25.1\n 36.5\n \n \n PTA\n %\n 41\n 25\n 19\n 14\n 51\n 55\n 31\n 70.0\n 130.0\n \n \n DD\n mg/L\n 32.9\n 35.1\n 24.5\n 25.6\n 18.7\n 24.7\n 64.8\n 0.0\n 5.0\n \n \n FDP\n µg/mL\n 84.7\n 92.5\n 77.2\n \n \n 157.2\n 291.7\n 0.0\n 5.0\n \n \n Fibrinogen\n mg/dL\n 238.1\n 216.8\n 135\n 85.2\n 105.7\n \n 64.3\n 200.0\n 400.0\n \n \n LDH\n U/L\n 5,727.3\n 2,622.8\n 2,418.7\n 546.3\n \n 637.2\n \n 80.0\n 285.0\n \n \n HBDH\n \n 5,971.2\n 5,826.9\n 4,826.9\n 2,871.2\n \n 1,163.6\n \n 74.0\n 182.0\n \n \n CK\n U/L\n 725\n 792.1\n 760.2\n 1,263.6\n \n 1,294.2\n \n 38.0\n 174.0\n \n \n CKMB\n U/L\n 75\n 71\n 58\n 65\n \n 68\n \n \n 25.0\n \n \n BNP\n pg/mL\n 37\n \n 73\n \n 482\n 421\n 1,332\n \n 100.0\n \n \n MYO\n ng/mL\n 636.6\n 762.1\n 364.6\n 9,999\n 9,999\n 9,999\n 9,999\n 0.0\n 140.0\n \n \n TnI\n ng/mL\n 0.03\n 0.04\n 0.05\n 0.16\n 0.14\n 2.84\n 8.94\n 0.0\n 0.028\n \n \n CREA\n µmol/L\n 705.6\n 683.6\n 523.6\n 374\n 259.6\n 241.8\n 211.4\n 59.0\n 104.0\n \n \n BUN\n mmol/L\n 20.13\n 25.33\n 13.33\n 7.84\n 4.23\n 3.92\n 3.41\n 1.7\n 8.3\n \n \n AMY\n U/L\n \n 232.8\n 394.6\n 513.7\n \n 642.9\n 538.9\n 0.0\n 115.0\n \n \n LPS\n U/L\n \n 227.6\n 526.9\n 487.9\n \n 437.8\n 414.5\n 5.6\n 51.3\n \n \n K\n mmol/L\n 4.19\n 4.64\n 4.34\n 4.83\n 4.53\n 4.37\n 5.74\n 3.5\n 5.3\n \n \n Na\n mmol/L\n 136.3\n 135.7\n 142.1\n 140.8\n 144.8\n 143.6\n 144.2\n 137.0\n 147.0\n \n \n Cl\n mmol/L\n 91.2\n 92.9\n 96.6\n 99.2\n 102.1\n 99.5\n 105.2\n 99.0\n 110.0\n \n \n Ca\n mmol/L\n 1.74\n 1.64\n 2.25\n 2.35\n 2.16\n 2.03\n 2.29\n 2.2\n 2.55\n \n \n P\n mmol/L\n 2.96\n 3.23\n 1.47\n 1.15\n 0.97\n 1.57\n 1.63\n 0.81\n 1.45\n \n \n Lac\n mmol/L\n 2.32\n 2.42\n 2.19\n 2.66\n \n 6.15\n 5.46\n 1.33\n 1.78\n \n \n CRP\n mg/L\n 43.6\n 38.6\n 28.6\n 21.5\n \n 4.3\n 6.4\n 0.0\n 5.0\n \n \n PCT\n ng/mL\n 0.57\n \n 1.35\n 2.26\n 1.79\n 3.48\n 5.92\n \n 0.05\n \n \n IL-6\n \n \n \n 165.9\n 58.3\n 74.6\n 737.2\n \n \n 7.0\n \n \n CD3+CD4+\n T cells per µL\n \n 174\n 153\n 184\n 243\n 370\n 252\n 706.0\n 1125.0\n \n \n CD3+CD8+\n T cells per µL\n \n 142\n 135\n 126\n 132\n 511\n 410\n 323.0\n 836.0\n \n\n\n\n\n\n\n \n\n\nThe constants dataset contains values for hundreds of fundamental physical constants. We’ll take a subset of values that have some molar basis and generate a new display table from that. Like the illness dataset, this one has a units column so, again, the fmt_units() method will be used to format those units. Here, the preference for typesetting measurement units is to have positive and negative exponents (e.g., not \"<unit_1> / <unit_2>\" but rather \"<unit_1> <unit_2>^-1\").\n\nfrom great_tables.data import constants\nimport polars as pl\nimport polars.selectors as cs\n\nconstants_mini = (\n pl.from_pandas(constants)\n .filter(pl.col(\"name\").str.contains(\"molar\")).sort(\"value\")\n .with_columns(\n name=pl.col(\"name\")\n .str.to_titlecase()\n .str.replace(\"Kpa\", \"kpa\")\n .str.replace(\"Of\", \"of\")\n )\n)\n\n(\n GT(constants_mini)\n .cols_hide(columns=[\"uncert\", \"sf_value\", \"sf_uncert\"])\n .fmt_units(columns=\"units\")\n .fmt_scientific(columns=\"value\", decimals=3)\n .tab_header(title=\"Physical Constants Having a Molar Basis\")\n .tab_options(column_labels_hidden=True)\n)\n\n\n\n\n\n\n \n Physical Constants Having a Molar Basis\n \n\n\n\n \n Molar Planck Constant\n 3.990 × 10−10\n J Hz−1 mol−1\n \n \n Electron Molar Mass\n 5.486 × 10−7\n kg mol−1\n \n \n Molar Volume of Silicon\n 1.206 × 10−5\n m3 mol−1\n \n \n Muon Molar Mass\n 1.134 × 10−4\n kg mol−1\n \n \n Molar Mass Constant\n 1.000 × 10−3\n kg mol−1\n \n \n Proton Molar Mass\n 1.007 × 10−3\n kg mol−1\n \n \n Neutron Molar Mass\n 1.009 × 10−3\n kg mol−1\n \n \n Tau Molar Mass\n 1.908 × 10−3\n kg mol−1\n \n \n Deuteron Molar Mass\n 2.014 × 10−3\n kg mol−1\n \n \n Helion Molar Mass\n 3.015 × 10−3\n kg mol−1\n \n \n Triton Molar Mass\n 3.016 × 10−3\n kg mol−1\n \n \n Alpha Particle Molar Mass\n 4.002 × 10−3\n kg mol−1\n \n \n Molar Mass of Carbon-12\n 1.200 × 10−2\n kg mol−1\n \n \n Molar Volume of Ideal Gas (273.15 K, 101.325 kpa)\n 2.241 × 10−2\n m3 mol−1\n \n \n Molar Volume of Ideal Gas (273.15 K, 100 kpa)\n 2.271 × 10−2\n m3 mol−1\n \n \n Molar Gas Constant\n 8.314\n J mol−1 K−1\n \n\n\n\n\n\n\n \n\n\n\n\nSee Also\nThe define_units() function can be used as a standalone utility for working with units notation. It can parses strings in units notation and can emit formatted units with its .to_html() method.\n\n\n\nopt_align_table_header\nGT.opt_align_table_header(self, align='center')\nOption to align the table header.\nBy default, an added table header will have center alignment for both the title and the subtitle elements. This method allows us to easily set the horizontal alignment of the title and subtitle to the left, right, or center by using the \"align\" argument. This method serves as a convenient shortcut for gt.tab_options(heading_align=<align>).\n\nParameters\n\n\n\n\n\n\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\nalign\nstr\nThe alignment of the title and subtitle elements in the table header. Options are \"center\" (the default), \"left\", or \"right\".\n'center'\n\n\n\n\n\nReturns\n\n\n\nType\nDescription\n\n\n\n\nGT\nThe GT object is returned. This is the same object that the method is called on so that we can facilitate method chaining.\n\n\n\n\n\nExamples\nUsing select columns from the exibble dataset, let’s create a table with a number of components added. Following that, we’ll align the header contents (consisting of the title and the subtitle) to the left with the opt_align_table_header() method.\n\nfrom great_tables import GT, exibble, md\n\n(\n GT(\n exibble[[\"num\", \"char\", \"currency\", \"row\", \"group\"]],\n rowname_col=\"row\",\n groupname_col=\"group\"\n )\n .tab_header(\n title=md(\"Data listing from **exibble**\"),\n subtitle=md(\"`exibble` is a **Great Tables** dataset.\")\n )\n .fmt_number(columns=\"num\")\n .fmt_currency(columns=\"currency\")\n .tab_source_note(source_note=\"This is only a subset of the dataset.\")\n .opt_align_table_header(align=\"left\")\n)\n\n\n\n\n\n\n \n Data listing from exibble\n \n \n exibble is a Great Tables dataset.\n \n\n \n num\n char\n currency\n\n\n\n \n grp_a\n \n \n row_1\n 0.11\n apricot\n $49.95\n \n \n row_2\n 2.22\n banana\n $17.95\n \n \n row_3\n 33.33\n coconut\n $1.39\n \n \n row_4\n 444.40\n durian\n $65,100.00\n \n \n grp_b\n \n \n row_5\n 5,550.00\n \n $1,325.81\n \n \n row_6\n \n fig\n $13.26\n \n \n row_7\n 777,000.00\n grapefruit\n \n \n \n row_8\n 8,880,000.00\n honeydew\n $0.44\n \n\n \n \n \n This is only a subset of the dataset.\n \n\n\n\n\n\n\n \n\n\n\n\n\nopt_all_caps\nGT.opt_all_caps(self, all_caps=True, locations=['column_labels', 'stub', 'row_group'])\nOption to use all caps in select table locations.\nSometimes an all-capitalized look is suitable for a table. By using opt_all_caps(), we can transform characters in the column labels, the stub, and in all row groups in this way (and there’s control over which of these locations are transformed). This method serves as a convenient shortcut for tab_options(<location>_text_transform=\"uppercase\", <location>_font_size=\"80%\", <location>_font_weight=\"bolder\") (for all locations selected).\n\nParameters\n\n\n\n\n\n\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\nall_caps\nbool\nIndicates whether the text transformation to all caps should be performed (True, the default) or reset to default values (False) for the locations targeted.\nTrue\n\n\nlocations\nstr | list[str]\nWhich locations should undergo this text transformation? By default it includes all of the \"column_labels\", the \"stub\", and the \"row_group\" locations. However, we could just choose one or two of those.\n['column_labels', 'stub', 'row_group']\n\n\n\n\n\nReturns\n\n\n\nType\nDescription\n\n\n\n\nGT\nThe GT object is returned. This is the same object that the method is called on so that we can facilitate method chaining.\n\n\n\n\n\nExamples\nUsing select columns from the exibble dataset, let’s create a table with a number of components added. Following that, we’ll ensure that all text in the column labels, the stub, and in all row groups is transformed to all caps using the opt_all_caps() method.\n\nfrom great_tables import GT, exibble, md\n\n(\n GT(\n exibble[[\"num\", \"char\", \"currency\", \"row\", \"group\"]],\n rowname_col=\"row\",\n groupname_col=\"group\"\n )\n .tab_header(\n title=md(\"Data listing from **exibble**\"),\n subtitle=md(\"`exibble` is a **Great Tables** dataset.\")\n )\n .fmt_number(columns=\"num\")\n .fmt_currency(columns=\"currency\")\n .tab_source_note(source_note=\"This is only a subset of the dataset.\")\n .opt_all_caps()\n)\n\n\n\n\n\n\n \n Data listing from exibble\n \n \n exibble is a Great Tables dataset.\n \n\n \n num\n char\n currency\n\n\n\n \n grp_a\n \n \n row_1\n 0.11\n apricot\n $49.95\n \n \n row_2\n 2.22\n banana\n $17.95\n \n \n row_3\n 33.33\n coconut\n $1.39\n \n \n row_4\n 444.40\n durian\n $65,100.00\n \n \n grp_b\n \n \n row_5\n 5,550.00\n \n $1,325.81\n \n \n row_6\n \n fig\n $13.26\n \n \n row_7\n 777,000.00\n grapefruit\n \n \n \n row_8\n 8,880,000.00\n honeydew\n $0.44\n \n\n \n \n \n This is only a subset of the dataset.\n \n\n\n\n\n\n\n \n\n\n\n\n\nopt_footnote_marks\nGT.opt_footnote_marks(self, marks='numbers')\nOption to modify the set of footnote marks Alter the footnote marks for any footnotes that may be present in the table. Either a list of marks can be provided (including Unicode characters), or, a specific keyword could be used to signify a preset sequence. This method serves as a shortcut for using tab_options(footnotes_marks=<marks>)\nWe can supply a list of strings will represent the series of marks. The series of footnote marks is recycled when its usage goes beyond the length of the set. At each cycle, the marks are simply doubled, tripled, and so on (e.g., * -> ** -> ***). The option exists for providing keywords for certain types of footnote marks. The keywords are\n\n\"numbers\": numeric marks, they begin from 1 and these marks are not subject to recycling behavior\n\"letters\": lowercase alphabetic marks. Same as using the gt.letters() function which produces a list of 26 lowercase letters from the Roman alphabet\n\"LETTERS\": uppercase alphabetic marks. Same as using the gt.LETTERS() function which produces a list of 26 uppercase letters from the Roman alphabet\n\"standard\": symbolic marks, four symbols in total\n\"extended\": symbolic marks, extends the standard set by adding two more symbols, making six\n\n\nParameters\n\n\n\n\n\n\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\nmarks\nstr | list[str]\nEither a list of strings that will represent the series of marks or a keyword string that represents a preset sequence of marks. The valid keywords are: \"numbers\" (for numeric marks), \"letters\" and \"LETTERS\" (for lowercase and uppercase alphabetic marks), \"standard\" (for a traditional set of four symbol marks), and \"extended\" (which adds two more symbols to the standard set).\n'numbers'\n\n\n\n\n\nReturns\n\n\n\nType\nDescription\n\n\n\n\nGT\nThe GT object is returned. This is the same object that the method is called on so that we can facilitate method chaining.\n\n\n\n\n\n\nopt_horizontal_padding\nGT.opt_horizontal_padding(self, scale=1.0)\nOption to scale the horizontal padding of the table.\nThis method allows us to scale the horizontal padding of the table by a factor of scale. The default value is 1.0 and this method serves as a convenient shortcut for gt.tab_options( heading_padding_horizontal=<new_val>, column_labels_padding_horizontal=<new_val>, data_row_padding_horizontal=<new_val>, row_group_padding_horizontal=<new_val>, source_notes_padding_horizontal=<new_val>).\n\nParameters\n\n\n\n\n\n\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\nscale\nfloat\nThe factor by which to scale the horizontal padding. The default value is 1.0. A value less than 1.0 will reduce the padding, and a value greater than 1.0 will increase the padding. The value must be between 0 and 3.\n1.0\n\n\n\n\n\nReturns\n\n\n\nType\nDescription\n\n\n\n\nGT\nThe GT object is returned. This is the same object that the method is called on so that we can facilitate method chaining.\n\n\n\n\n\nExamples\nUsing select columns from the exibble dataset, let’s create a table with a number of components added. Following that, we’ll scale the horizontal padding of the table by a factor of 3 using the opt_horizontal_padding() method.\n\nfrom great_tables import GT, exibble, md\n\ngt_tbl = (\n GT(\n exibble[[\"num\", \"char\", \"currency\", \"row\", \"group\"]],\n rowname_col=\"row\",\n groupname_col=\"group\"\n )\n .tab_header(\n title=md(\"Data listing from **exibble**\"),\n subtitle=md(\"`exibble` is a **Great Tables** dataset.\")\n )\n .fmt_number(columns=\"num\")\n .fmt_currency(columns=\"currency\")\n .tab_source_note(source_note=\"This is only a subset of the dataset.\")\n)\n\ngt_tbl.opt_horizontal_padding(scale=3)\n\n\n\n\n\n\n \n Data listing from exibble\n \n \n exibble is a Great Tables dataset.\n \n\n \n num\n char\n currency\n\n\n\n \n grp_a\n \n \n row_1\n 0.11\n apricot\n $49.95\n \n \n row_2\n 2.22\n banana\n $17.95\n \n \n row_3\n 33.33\n coconut\n $1.39\n \n \n row_4\n 444.40\n durian\n $65,100.00\n \n \n grp_b\n \n \n row_5\n 5,550.00\n \n $1,325.81\n \n \n row_6\n \n fig\n $13.26\n \n \n row_7\n 777,000.00\n grapefruit\n \n \n \n row_8\n 8,880,000.00\n honeydew\n $0.44\n \n\n \n \n \n This is only a subset of the dataset.\n \n\n\n\n\n\n\n \n\n\nThe overall effect of scaling the horizontal padding is that the table will appear wider or and there will added buffer space between the table elements. The overall look of the table will be more spacious and neigboring pieces of text will be less cramped.\nLet’s go the other way and scale the horizontal padding of the table by a factor of 0.5 using the opt_horizontal_padding() method.\n\ngt_tbl.opt_horizontal_padding(scale=0.5)\n\n\n\n\n\n\n \n Data listing from exibble\n \n \n exibble is a Great Tables dataset.\n \n\n \n num\n char\n currency\n\n\n\n \n grp_a\n \n \n row_1\n 0.11\n apricot\n $49.95\n \n \n row_2\n 2.22\n banana\n $17.95\n \n \n row_3\n 33.33\n coconut\n $1.39\n \n \n row_4\n 444.40\n durian\n $65,100.00\n \n \n grp_b\n \n \n row_5\n 5,550.00\n \n $1,325.81\n \n \n row_6\n \n fig\n $13.26\n \n \n row_7\n 777,000.00\n grapefruit\n \n \n \n row_8\n 8,880,000.00\n honeydew\n $0.44\n \n\n \n \n \n This is only a subset of the dataset.\n \n\n\n\n\n\n\n \n\n\nWhat you get in this case is more condensed text across the horizontal axis. This may not always be desired when cells consist mainly of text, but it could be useful when the table is more visual and the cells are filled with graphics or other non-textual elements.\n\n\n\nopt_row_striping\nGT.opt_row_striping(self, row_striping=True)\nOption to add or remove row striping.\nBy default, a table does not have row striping enabled. However, this method allows us to easily enable or disable striped rows in the table body. It’s a convenient shortcut for tab_options(row_striping_include_table_body=<True|False>).\n\nParameters\n\n\n\n\n\n\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\nrow_striping\nbool\nA boolean that indicates whether row striping should be added or removed. Defaults to True.\nTrue\n\n\n\n\n\nReturns\n\n\n\nType\nDescription\n\n\n\n\nGT\nThe GT object is returned. This is the same object that the method is called on so that we can facilitate method chaining.\n\n\n\n\n\nExamples\nUsing only a few columns from the exibble dataset, let’s create a table with a number of components added. Following that, we’ll add row striping to every second row with the opt_row_striping() method.\n\nfrom great_tables import GT, exibble, md\n\n(\n GT(\n exibble[[\"num\", \"char\", \"currency\", \"row\", \"group\"]],\n rowname_col=\"row\",\n groupname_col=\"group\"\n )\n .tab_header(\n title=md(\"Data listing from **exibble**\"),\n subtitle=md(\"`exibble` is a **Great Tables** dataset.\")\n )\n .fmt_number(columns=\"num\")\n .fmt_currency(columns=\"currency\")\n .tab_source_note(source_note=\"This is only a subset of the dataset.\")\n .opt_row_striping()\n)\n\n\n\n\n\n\n \n Data listing from exibble\n \n \n exibble is a Great Tables dataset.\n \n\n \n num\n char\n currency\n\n\n\n \n grp_a\n \n \n row_1\n 0.11\n apricot\n $49.95\n \n \n row_2\n 2.22\n banana\n $17.95\n \n \n row_3\n 33.33\n coconut\n $1.39\n \n \n row_4\n 444.40\n durian\n $65,100.00\n \n \n grp_b\n \n \n row_5\n 5,550.00\n \n $1,325.81\n \n \n row_6\n \n fig\n $13.26\n \n \n row_7\n 777,000.00\n grapefruit\n \n \n \n row_8\n 8,880,000.00\n honeydew\n $0.44\n \n\n \n \n \n This is only a subset of the dataset.\n \n\n\n\n\n\n\n \n\n\n\n\n\nopt_stylize\nGT.opt_stylize(self, style=1, color='blue', add_row_striping=True)\nStylize your table with a colorful look.\nWith the opt_stylize() method you can quickly style your table with a carefully curated set of background colors, line colors, and line styles. There are six styles to choose from and they largely vary in the extent of coloring applied to different table locations. Some have table borders applied, some apply darker colors to the table stub and summary sections, and, some even have vertical lines. In addition to choosing a style preset, there are six color variations that each use a range of five color tints. Each of the color tints have been fine-tuned to maximize the contrast between text and its background. There are 36 combinations of style and color to choose from. For examples of each style, see the Premade Themes section of the Get Started guide.\n\nParameters\n\n\n\n\n\n\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\nstyle\nint\nSix numbered styles are available. Simply provide a number from 1 (the default) to 6 to choose a distinct look.\n1\n\n\ncolor\nstr\nThe color scheme of the table. The default value is \"blue\". The valid values are \"blue\", \"cyan\", \"pink\", \"green\", \"red\", and \"gray\".\n'blue'\n\n\nadd_row_striping\nbool\nAn option to enable row striping in the table body for the style chosen.\nTrue\n\n\n\n\n\nReturns\n\n\n\nType\nDescription\n\n\n\n\nGT\nThe GT object is returned. This is the same object that the method is called on so that we can facilitate method chaining.\n\n\n\n\n\nExamples\nUsing select columns from the exibble dataset, let’s create a table with a number of components added. Following that, we’ll apply a predefined style to the table using the opt_stylize() method.\n\nfrom great_tables import GT, exibble, md\n\ngt_tbl = (\n GT(\n exibble[[\"num\", \"char\", \"currency\", \"row\", \"group\"]],\n rowname_col=\"row\",\n groupname_col=\"group\"\n )\n .tab_header(\n title=md(\"Data listing from **exibble**\"),\n subtitle=md(\"`exibble` is a **Great Tables** dataset.\")\n )\n .fmt_number(columns=\"num\")\n .fmt_currency(columns=\"currency\")\n .tab_source_note(source_note=\"This is only a subset of the dataset.\")\n .opt_stylize()\n )\n\ngt_tbl\n\n\n\n\n\n\n \n Data listing from exibble\n \n \n exibble is a Great Tables dataset.\n \n\n \n num\n char\n currency\n\n\n\n \n grp_a\n \n \n row_1\n 0.11\n apricot\n $49.95\n \n \n row_2\n 2.22\n banana\n $17.95\n \n \n row_3\n 33.33\n coconut\n $1.39\n \n \n row_4\n 444.40\n durian\n $65,100.00\n \n \n grp_b\n \n \n row_5\n 5,550.00\n \n $1,325.81\n \n \n row_6\n \n fig\n $13.26\n \n \n row_7\n 777,000.00\n grapefruit\n \n \n \n row_8\n 8,880,000.00\n honeydew\n $0.44\n \n\n \n \n \n This is only a subset of the dataset.\n \n\n\n\n\n\n\n \n\n\nThe table has been stylized with the default style and color. The default style is 1 and the default color is \"blue\". The resulting table style is a combination of color and border settings that are applied to the table.\nWe can modify the overall style and choose a different color theme by providing different values to the style= and color= arguments.\n\ngt_tbl.opt_stylize(style=2, color=\"green\")\n\n\n\n\n\n\n \n Data listing from exibble\n \n \n exibble is a Great Tables dataset.\n \n\n \n num\n char\n currency\n\n\n\n \n grp_a\n \n \n row_1\n 0.11\n apricot\n $49.95\n \n \n row_2\n 2.22\n banana\n $17.95\n \n \n row_3\n 33.33\n coconut\n $1.39\n \n \n row_4\n 444.40\n durian\n $65,100.00\n \n \n grp_b\n \n \n row_5\n 5,550.00\n \n $1,325.81\n \n \n row_6\n \n fig\n $13.26\n \n \n row_7\n 777,000.00\n grapefruit\n \n \n \n row_8\n 8,880,000.00\n honeydew\n $0.44\n \n\n \n \n \n This is only a subset of the dataset.\n \n\n\n\n\n\n\n \n\n\n\n\n\nopt_table_font\nGT.opt_table_font(self, font=None, stack=None, weight=None, style=None, add=True)\nOptions to define font choices for the entire table.\nThe opt_table_font() method makes it possible to define fonts used for an entire table. Any font names supplied in font= will (by default, with add=True) be placed before the names present in the existing font stack (i.e., they will take precedence). You can choose to base the font stack on those provided by the system_fonts() helper function by providing a valid keyword for a themed set of fonts. Take note that you could still have entirely different fonts in specific locations of the table. To make that possible you would need to use tab_style() in conjunction with style.text().\n\nParameters\n\n\n\n\n\n\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\nfont\nstr | list[str] | dict[str, str] | None\nOne or more font names available on the user system. This can be a string or a list of strings. The default value is None since you could instead opt to use stack to define a list of fonts.\nNone\n\n\nstack\nFontStackName | None\nA name that is representative of a font stack (obtained via internally via the system_fonts() helper function. If provided, this new stack will replace any defined fonts and any font= values will be prepended.\nNone\n\n\nstyle\nstr | None\nAn option to modify the text style. Can be one of either \"normal\", \"italic\", or \"oblique\".\nNone\n\n\nweight\nstr | int | float | None\nOption to set the weight of the font. Can be a text-based keyword such as \"normal\", \"bold\", \"lighter\", \"bolder\", or, a numeric value between 1 and 1000. Please note that typefaces have varying support for the numeric mapping of weight.\nNone\n\n\nadd\nbool\nShould fonts be added to the beginning of any already-defined fonts for the table? By default, this is True and is recommended since those fonts already present can serve as fallbacks when everything specified in font is not available. If a stack= value is provided, then add will automatically set to False.\nTrue\n\n\n\n\n\nReturns\n\n\n\nType\nDescription\n\n\n\n\nGT\nThe GT object is returned. This is the same object that the method is called on so that we can facilitate method chaining.\n\n\n\n\n\nPossibilities For The Stack Argument\nThere are several themed font stacks available via the system_fonts() helper function. That function can be used to generate all or a segment of a list supplied to the font= argument. However, using the stack= argument with one of the 15 keywords for the font stacks available in system_fonts(), we could be sure that the typeface class will work across multiple computer systems. Any of the following keywords can be used with stack=:\n\n\"system-ui\"\n\"transitional\"\n\"old-style\"\n\"humanist\"\n\"geometric-humanist\"\n\"classical-humanist\"\n\"neo-grotesque\"\n\"monospace-slab-serif\"\n\"monospace-code\"\n\"industrial\"\n\"rounded-sans\"\n\"slab-serif\"\n\"antique\"\n\"didone\"\n\"handwritten\"\n\n\n\nExamples\nLet’s use a subset of the sp500 dataset to create a small table. With opt_table_font() we can add some preferred font choices for modifying the text of the entire table. Here we’ll use the \"Superclarendon\" and \"Georgia\" fonts (the second font serves as a fallback).\n\nimport polars as pl\nfrom great_tables import GT\nfrom great_tables.data import sp500\n\nsp500_mini = pl.from_pandas(sp500).slice(0, 10).drop([\"volume\", \"adj_close\"])\n\n(\n GT(sp500_mini, rowname_col=\"date\")\n .fmt_currency(use_seps=False)\n .opt_table_font(font=[\"Superclarendon\", \"Georgia\"])\n)\n\n\n\n\n\n\n\n \n open\n high\n low\n close\n\n\n\n \n 2015-12-31\n $2060.59\n $2062.54\n $2043.62\n $2043.94\n \n \n 2015-12-30\n $2077.34\n $2077.34\n $2061.97\n $2063.36\n \n \n 2015-12-29\n $2060.54\n $2081.56\n $2060.54\n $2078.36\n \n \n 2015-12-28\n $2057.77\n $2057.77\n $2044.20\n $2056.50\n \n \n 2015-12-24\n $2063.52\n $2067.36\n $2058.73\n $2060.99\n \n \n 2015-12-23\n $2042.20\n $2064.73\n $2042.20\n $2064.29\n \n \n 2015-12-22\n $2023.15\n $2042.74\n $2020.49\n $2038.97\n \n \n 2015-12-21\n $2010.27\n $2022.90\n $2005.93\n $2021.15\n \n \n 2015-12-18\n $2040.81\n $2040.81\n $2005.33\n $2005.55\n \n \n 2015-12-17\n $2073.76\n $2076.37\n $2041.66\n $2041.89\n \n\n\n\n\n\n\n \n\n\nIn practice, both of these fonts are not likely to be available on all systems. The opt_table_font() method safeguards against this by prepending the fonts in the font= list to the existing font stack. This way, if both fonts are not available, the table will fall back to using the list of default table fonts. This behavior is controlled by the add= argument, which is True by default.\nWith the sza dataset we’ll create a two-column, eleven-row table. Within opt_table_font(), the stack= argument will be supplied with the “rounded-sans” font stack. This sets up a family of fonts with rounded, curved letterforms that should be locally available in different computing environments.\n\nfrom great_tables.data import sza\n\nsza_mini = (\n pl.from_pandas(sza)\n .filter((pl.col(\"latitude\") == \"20\") & (pl.col(\"month\") == \"jan\"))\n .drop_nulls()\n .drop([\"latitude\", \"month\"])\n)\n\n(\n GT(sza_mini)\n .opt_table_font(stack=\"rounded-sans\")\n .opt_all_caps()\n)\n\n\n\n\n\n\n\n tst\n sza\n\n\n\n \n 0700\n 84.9\n \n \n 0730\n 78.7\n \n \n 0800\n 72.7\n \n \n 0830\n 66.1\n \n \n 0900\n 61.5\n \n \n 0930\n 56.5\n \n \n 1000\n 52.1\n \n \n 1030\n 48.3\n \n \n 1100\n 45.5\n \n \n 1130\n 43.6\n \n \n 1200\n 43.0\n \n\n\n\n\n\n\n \n\n\n\n\n\nopt_table_outline\nGT.opt_table_outline(self, style='solid', width='3px', color='#D3D3D3')\nOption to wrap an outline around the entire table.\nThe opt_table_outline() method puts an outline of consistent style=, width=, and color= around the entire table. It’ll write over any existing outside lines so long as the width= value is larger that of the existing lines. The default value of style= (\"solid\") will draw a solid outline, whereas using \"none\" will remove any present outline.\n\nParameters\n\n\n\n\n\n\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\nstyle\nstr\nThe style of the table outline. The default value is \"solid\". The valid values are \"solid\", \"dashed\", \"dotted\", and \"none\".\n'solid'\n\n\nwidth\nstr\nThe width of the table outline. The default value is \"3px\". The value must be in pixels and it must be an integer value.\n'3px'\n\n\ncolor\nstr\nThe color of the table outline, where the default is \"#D3D3D3\". The value must either a hexadecimal color code or a color name.\n'#D3D3D3'\n\n\n\n\n\nReturns\n\n\n\nType\nDescription\n\n\n\n\nGT\nThe GT object is returned. This is the same object that the method is called on so that we can facilitate method chaining.\n\n\n\n\n\nExamples\nUsing select columns from the exibble dataset, let’s create a table with a number of components added. Following that, we’ll put an outline around the entire table using the opt_table_outline() method.\n\nfrom great_tables import GT, exibble, md\n\n(\n GT(\n exibble[[\"num\", \"char\", \"currency\", \"row\", \"group\"]],\n rowname_col=\"row\",\n groupname_col=\"group\"\n )\n .tab_header(\n title=md(\"Data listing from **exibble**\"),\n subtitle=md(\"`exibble` is a **Great Tables** dataset.\")\n )\n .fmt_number(columns=\"num\")\n .fmt_currency(columns=\"currency\")\n .tab_source_note(source_note=\"This is only a subset of the dataset.\")\n .opt_table_outline()\n)\n\n\n\n\n\n\n \n Data listing from exibble\n \n \n exibble is a Great Tables dataset.\n \n\n \n num\n char\n currency\n\n\n\n \n grp_a\n \n \n row_1\n 0.11\n apricot\n $49.95\n \n \n row_2\n 2.22\n banana\n $17.95\n \n \n row_3\n 33.33\n coconut\n $1.39\n \n \n row_4\n 444.40\n durian\n $65,100.00\n \n \n grp_b\n \n \n row_5\n 5,550.00\n \n $1,325.81\n \n \n row_6\n \n fig\n $13.26\n \n \n row_7\n 777,000.00\n grapefruit\n \n \n \n row_8\n 8,880,000.00\n honeydew\n $0.44\n \n\n \n \n \n This is only a subset of the dataset.\n \n\n\n\n\n\n\n \n\n\n\n\n\nopt_vertical_padding\nGT.opt_vertical_padding(self, scale=1.0)\nOption to scale the vertical padding of the table.\nThis method allows us to scale the vertical padding of the table by a factor of scale. The default value is 1.0 and this method serves as a convenient shortcut for gt.tab_options(heading_padding=<new_val>, column_labels_padding=<new_val>, data_row_padding=<new_val>, row_group_padding=<new_val>, source_notes_padding=<new_val>).\n\nParameters\n\n\n\n\n\n\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\nscale\nfloat\nThe factor by which to scale the vertical padding. The default value is 1.0. A value less than 1.0 will reduce the padding, and a value greater than 1.0 will increase the padding. The value must be between 0 and 3.\n1.0\n\n\n\n\n\nReturns\n\n\n\nType\nDescription\n\n\n\n\nGT\nThe GT object is returned. This is the same object that the method is called on so that we can facilitate method chaining.\n\n\n\n\n\nExamples\nUsing select columns from the exibble dataset, let’s create a table with a number of components added. Following that, we’ll scale the vertical padding of the table by a factor of 3 using the opt_vertical_padding() method.\n\nfrom great_tables import GT, exibble, md\n\ngt_tbl = (\n GT(\n exibble[[\"num\", \"char\", \"currency\", \"row\", \"group\"]],\n rowname_col=\"row\",\n groupname_col=\"group\"\n )\n .tab_header(\n title=md(\"Data listing from **exibble**\"),\n subtitle=md(\"`exibble` is a **Great Tables** dataset.\")\n )\n .fmt_number(columns=\"num\")\n .fmt_currency(columns=\"currency\")\n .tab_source_note(source_note=\"This is only a subset of the dataset.\")\n)\n\ngt_tbl.opt_vertical_padding(scale=3)\n\n\n\n\n\n\n \n Data listing from exibble\n \n \n exibble is a Great Tables dataset.\n \n\n \n num\n char\n currency\n\n\n\n \n grp_a\n \n \n row_1\n 0.11\n apricot\n $49.95\n \n \n row_2\n 2.22\n banana\n $17.95\n \n \n row_3\n 33.33\n coconut\n $1.39\n \n \n row_4\n 444.40\n durian\n $65,100.00\n \n \n grp_b\n \n \n row_5\n 5,550.00\n \n $1,325.81\n \n \n row_6\n \n fig\n $13.26\n \n \n row_7\n 777,000.00\n grapefruit\n \n \n \n row_8\n 8,880,000.00\n honeydew\n $0.44\n \n\n \n \n \n This is only a subset of the dataset.\n \n\n\n\n\n\n\n \n\n\nNow that’s a tall table! The overall effect of scaling the vertical padding is that the table will appear taller and there will be more buffer space between the table elements. A value of 3 is pretty extreme and is likely to be too much in most cases, so, feel free to experiment with different values when looking to increase the vertical padding.\nLet’s go the other way (using a value less than 1) and try to condense the content vertically with a scale factor of 0.5. This will reduce the top and bottom padding globally and make the table appear more compact.\n\ngt_tbl.opt_vertical_padding(scale=0.5)\n\n\n\n\n\n\n \n Data listing from exibble\n \n \n exibble is a Great Tables dataset.\n \n\n \n num\n char\n currency\n\n\n\n \n grp_a\n \n \n row_1\n 0.11\n apricot\n $49.95\n \n \n row_2\n 2.22\n banana\n $17.95\n \n \n row_3\n 33.33\n coconut\n $1.39\n \n \n row_4\n 444.40\n durian\n $65,100.00\n \n \n grp_b\n \n \n row_5\n 5,550.00\n \n $1,325.81\n \n \n row_6\n \n fig\n $13.26\n \n \n row_7\n 777,000.00\n grapefruit\n \n \n \n row_8\n 8,880,000.00\n honeydew\n $0.44\n \n\n \n \n \n This is only a subset of the dataset.\n \n\n\n\n\n\n\n \n\n\nA value of 0.5 provides a reasonable amount of vertical padding and the table will appear more compact. This is useful when space is limited and, in such a situation, this is a practical solution to that problem.\n\n\n\nsave\nGT.save(self, file, selector='table', scale=1.0, expand=5, web_driver='chrome', window_size=(6000, 6000), debug_port=None, encoding='utf-8', _debug_dump=None)\nProduce a high-resolution image file or PDF of the table.\nThe output file is created by taking a screenshot of the table using a headless browser.\n\nParameters\n\n\n\n\n\n\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\nfile\nstr\nThe name of the file to save the image to. Accepts names ending with .png, .bmp, and other image extensions. Also accepts the extension .pdf.\nrequired\n\n\nselector\nstr\n(NOT IMPLEMENTED) The HTML element name used to select table. Defaults to the whole table.\n'table'\n\n\nscale\nfloat\nThe scaling factor that will be used when generating the image. Lower values decrease resolution. A scale of 2 is equivalent to doubling the width of the table in pixels. Note that higher resolution results in larger file sizes.\n1.0\n\n\nexpand\nint\n(NOT IMPLEMENTED) The number of pixels to expand the screenshot by. This can be increased to capture more of the surrounding area, or decreased to capture less.\n5\n\n\nweb_driver\nWebDrivers\nThe webdriver to use when taking the screenshot. By default, uses Google Chrome. Supports \"firefox\" (Mozilla Firefox), \"safari\" (Apple Safari), and \"edge\" (Microsoft Edge). Specified browser must be installed.\n'chrome'\n\n\nwindow_size\ntuple[int, int]\nThe size of the browser window to use when laying out the table. This shouldn’t be necessary to capture a table, but may affect the tables appearance.\n(6000, 6000)\n\n\ndebug_port\nNone | int\nPort number to use for debugging. By default no debugging port is opened.\nNone\n\n\nencoding\nstr\nThe encoding used when writing temporary files.\n'utf-8'\n\n\n_debug_dump\nDebugDumpOptions | None\nWhether the saved image should be a big browser window, with key elements outlined. This is helpful for debugging this function’s resizing, cropping heuristics. This is an internal parameter and subject to change.\nNone\n\n\n\n\n\nReturns\n\n\n\n\n\n\n\nType\nDescription\n\n\n\n\nNone\nThis function does not return anything; it simply saves the image to the specified file path.\n\n\n\n\n\nDetails\nWe create the output file based on the HTML version of the table.\nThis process is facilitated by two libraries:\n\nselenium, which is used to control the Chrome browser and take a screenshot of the table.\nPIL, which is used to crop the screenshot to only include the table element of the page.\n\nBoth of these packages needs to be installed before attempting to save any table as an image file. The selenium package also requires the Chrome browser to be installed on the system.\nA pip-based reinstallation of Great Tables through the following command will install these required packages:\npip install great_tables[extra]\n\n\n\nshow\nGT.show(self, target='auto')\nDisplay the table in a notebook or a web browser.\nNote that this function is often unecessary in a notebook. However, it’s sometimes useful for manually triggering display within a code cell.\n\nParameters\n\n\n\n\n\n\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\ntarget\nLiteral[‘auto’, ‘notebook’, ‘browser’]\nWhere to show the table. If “auto”, infer whether the table can be displayed inline (e.g. in a notebook), or whether a browser is needed (e.g. in a console).\n'auto'\n\n\n\n\n\nExamples\nThe example below when in the Great Tables documentation, should appear on the page.\n\nfrom great_tables import GT, exibble\n\nGT(exibble.head(2)).show()\nGT(exibble.tail(2)).show()\n\n\n\n\n\n\n\n num\n char\n fctr\n date\n time\n datetime\n currency\n row\n group\n\n\n\n \n 0.1111\n apricot\n one\n 2015-01-15\n 13:35\n 2018-01-01 02:22\n 49.95\n row_1\n grp_a\n \n \n 2.222\n banana\n two\n 2015-02-15\n 14:40\n 2018-02-02 14:33\n 17.95\n row_2\n grp_a\n \n\n\n\n\n\n\n \n\n\n\n\n\n\n\n\n num\n char\n fctr\n date\n time\n datetime\n currency\n row\n group\n\n\n\n \n 777000.0\n grapefruit\n seven\n \n 19:10\n 2018-07-07 05:22\n \n row_7\n grp_b\n \n \n 8880000.0\n honeydew\n eight\n 2015-08-15\n 20:20\n \n 0.44\n row_8\n grp_b\n \n\n\n\n\n\n\n \n\n\n\n\n\nsub_missing\nGT.sub_missing(self, columns=None, rows=None, missing_text=None)\nSubstitute missing values in the table body.\nWherever there is missing data (i.e., None values) customizable content may present better than the standard representation of missing values that would otherwise appear. The sub_missing() method allows for this replacement through its missing_text= argument. And by not supplying anything to missing_text=, an em dash will serve as a default indicator of missingness.\n\nParameters\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\ncolumns\nSelectExpr\nThe columns to target. Can either be a single column name or a series of column names provided in a list.\nNone\n\n\nrows\nint | list[int] | None\nIn conjunction with columns=, we can specify which of their rows should be scanned for missing values. The default is all rows, resulting in all rows in all targeted columns being considered for this substitution. Alternatively, we can supply a list of row indices.\nNone\n\n\nmissing_text\nstr | Text | None\nThe text to be used in place of missing values in the rendered table. We can optionally use the md() or html() helper functions to style the text as Markdown or to retain HTML elements in the text.\nNone\n\n\n\n\n\nReturns\n\n\n\nType\nDescription\n\n\n\n\nGT\nThe GT object is returned. This is the same object that the method is called on so that we can facilitate method chaining.\n\n\n\n\n\nExamples\nUsing a subset of the exibble dataset, let’s create a new table. The missing values in two selections of columns will be given different variations of replacement text (across two separate calls of sub_missing()).\n\nfrom great_tables import GT, md, html, exibble\nimport polars as pl\nimport polars.selectors as cs\n\nexibble_mini = pl.from_pandas(exibble).drop(\"row\", \"group\", \"fctr\").slice(4, 8)\n\n(\n GT(exibble_mini)\n .sub_missing(\n columns=[\"num\", \"char\"],\n missing_text=\"missing\"\n )\n .sub_missing(\n columns=cs.contains((\"date\", \"time\")) | cs.by_name(\"currency\"),\n missing_text=\"nothing\"\n )\n)\n\n\n\n\n\n\n\n num\n char\n date\n time\n datetime\n currency\n\n\n\n \n 5550.0\n missing\n 2015-05-15\n 17:55\n 2018-05-05 04:00\n 1325.81\n \n \n missing\n fig\n 2015-06-15\n nothing\n 2018-06-06 16:11\n 13.255\n \n \n 777000.0\n grapefruit\n nothing\n 19:10\n 2018-07-07 05:22\n nothing\n \n \n 8880000.0\n honeydew\n 2015-08-15\n 20:20\n nothing\n 0.44\n \n\n\n\n\n\n\n \n\n\n\n\n\nsub_zero\nGT.sub_zero(self, columns=None, rows=None, zero_text='nil')\nSubstitute zero values in the table body.\nWherever there is numerical data that are zero in value, replacement text may be better for explanatory purposes. The sub_zero() function allows for this replacement through its zero_text= argument.\n\nParameters\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\ncolumns\nSelectExpr\nThe columns to target. Can either be a single column name or a series of column names provided in a list.\nNone\n\n\nrows\nint | list[int] | None\nIn conjunction with columns=, we can specify which of their rows should be scanned for zeros. The default is all rows, resulting in all rows in all targeted columns being considered for this substitution. Alternatively, we can supply a list of row indices.\nNone\n\n\nzero_text\nstr\nThe text to be used in place of zero values in the rendered table. We can optionally use the md() or html() functions to style the text as Markdown or to retain HTML elements in the text.\n'nil'\n\n\n\n\n\nReturns\n\n\n\nType\nDescription\n\n\n\n\nGT\nThe GT object is returned. This is the same object that the method is called on so that we can facilitate method chaining.\n\n\n\n\n\nExamples\nLet’s generate a simple table that contains an assortment of values that could potentially undergo some substitution via the sub_zero() method (i.e., there are two 0 values). The ordering of the fmt_scientific() and sub_zero() calls in the example below doesn’t affect the final result since any sub_*() method won’t interfere with the formatting of the table.\n\nfrom great_tables import GT\nimport polars as pl\n\nsingle_vals_df = pl.DataFrame(\n {\n \"i\": range(1, 8),\n \"numbers\": [2.75, 0, -3.2, 8, 1e-10, 0, 2.6e9]\n }\n)\n\nGT(single_vals_df).fmt_scientific(columns=\"numbers\").sub_zero()\n\n\n\n\n\n\n\n i\n numbers\n\n\n\n \n 1\n 2.75\n \n \n 2\n nil\n \n \n 3\n −3.20\n \n \n 4\n 8.00\n \n \n 5\n 1.00 × 10−10\n \n \n 6\n nil\n \n \n 7\n 2.60 × 109\n \n\n\n\n\n\n\n \n\n\n\n\n\ntab_header\nGT.tab_header(self, title, subtitle=None, preheader=None)\nAdd a table header.\nWe can add a table header to the output table that contains a title and even a subtitle with the tab_header() method. A table header is an optional table component that is positioned above the column labels. We have the flexibility to use Markdown or HTML formatting for the header’s title and subtitle with the md() and html() helper functions.\n\nParameters\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\ntitle\nstr | Text\nText to be used in the table title. We can elect to use the md() and html() helper functions to style the text as Markdown or to retain HTML elements in the text.\nrequired\n\n\nsubtitle\nstr | Text | None\nText to be used in the table subtitle. We can elect to use the md() and html() helper functions to style the text as Markdown or to retain HTML elements in the text.\nNone\n\n\npreheader\nstr | list[str] | None\nOptional preheader content that is rendered above the table. Can be supplied as a list of strings.\nNone\n\n\n\n\n\nReturns\n\n\n\nType\nDescription\n\n\n\n\nGT\nThe GT object is returned. This is the same object that the method is called on so that we can facilitate method chaining.\n\n\n\n\n\nExamples\nLet’s use a small portion of the gtcars dataset to create a table. A header part can be added to the table with the tab_header() method. We’ll add a title and the optional subtitle as well. With the md() helper function, we can make sure the Markdown formatting is interpreted and transformed.\n\nfrom great_tables import GT, md\nfrom great_tables.data import gtcars\n\ngtcars_mini = gtcars[[\"mfr\", \"model\", \"msrp\"]].head(5)\n\n(\n GT(gtcars_mini)\n .tab_header(\n title=md(\"Data listing from **gtcars**\"),\n subtitle=md(\"`gtcars` is an R dataset\")\n )\n)\n\n\n\n\n\n\n \n Data listing from gtcars\n \n \n gtcars is an R dataset\n \n\n mfr\n model\n msrp\n\n\n\n \n Ford\n GT\n 447000.0\n \n \n Ferrari\n 458 Speciale\n 291744.0\n \n \n Ferrari\n 458 Spider\n 263553.0\n \n \n Ferrari\n 458 Italia\n 233509.0\n \n \n Ferrari\n 488 GTB\n 245400.0\n \n\n\n\n\n\n\n \n\n\nWe can alternatively use the html() helper function to retain HTML elements in the text.\n\nfrom great_tables import GT, md, html\nfrom great_tables.data import gtcars\n\ngtcars_mini = gtcars[[\"mfr\", \"model\", \"msrp\"]].head(5)\n\n(\n GT(gtcars_mini)\n .tab_header(\n title=md(\"Data listing <strong>gtcars</strong>\"),\n subtitle=html(\"From <span style='color:red;'>gtcars</span>\")\n )\n)\n\n\n\n\n\n\n \n Data listing gtcars\n \n \n From gtcars\n \n\n mfr\n model\n msrp\n\n\n\n \n Ford\n GT\n 447000.0\n \n \n Ferrari\n 458 Speciale\n 291744.0\n \n \n Ferrari\n 458 Spider\n 263553.0\n \n \n Ferrari\n 458 Italia\n 233509.0\n \n \n Ferrari\n 488 GTB\n 245400.0\n \n\n\n\n\n\n\n \n\n\n\n\n\ntab_options\nGT.tab_options(self, container_width=None, container_height=None, container_overflow_x=None, container_overflow_y=None, table_width=None, table_layout=None, table_margin_left=None, table_margin_right=None, table_background_color=None, table_additional_css=None, table_font_names=None, table_font_size=None, table_font_weight=None, table_font_style=None, table_font_color=None, table_font_color_light=None, table_border_top_style=None, table_border_top_width=None, table_border_top_color=None, table_border_bottom_style=None, table_border_bottom_width=None, table_border_bottom_color=None, table_border_left_style=None, table_border_left_width=None, table_border_left_color=None, table_border_right_style=None, table_border_right_width=None, table_border_right_color=None, heading_background_color=None, heading_align=None, heading_title_font_size=None, heading_title_font_weight=None, heading_subtitle_font_size=None, heading_subtitle_font_weight=None, heading_padding=None, heading_padding_horizontal=None, heading_border_bottom_style=None, heading_border_bottom_width=None, heading_border_bottom_color=None, heading_border_lr_style=None, heading_border_lr_width=None, heading_border_lr_color=None, column_labels_background_color=None, column_labels_font_size=None, column_labels_font_weight=None, column_labels_text_transform=None, column_labels_padding=None, column_labels_padding_horizontal=None, column_labels_vlines_style=None, column_labels_vlines_width=None, column_labels_vlines_color=None, column_labels_border_top_style=None, column_labels_border_top_width=None, column_labels_border_top_color=None, column_labels_border_bottom_style=None, column_labels_border_bottom_width=None, column_labels_border_bottom_color=None, column_labels_border_lr_style=None, column_labels_border_lr_width=None, column_labels_border_lr_color=None, column_labels_hidden=None, row_group_background_color=None, row_group_font_size=None, row_group_font_weight=None, row_group_text_transform=None, row_group_padding=None, row_group_padding_horizontal=None, row_group_border_top_style=None, row_group_border_top_width=None, row_group_border_top_color=None, row_group_border_bottom_style=None, row_group_border_bottom_width=None, row_group_border_bottom_color=None, row_group_border_left_style=None, row_group_border_left_width=None, row_group_border_left_color=None, row_group_border_right_style=None, row_group_border_right_width=None, row_group_border_right_color=None, row_group_as_column=None, table_body_hlines_style=None, table_body_hlines_width=None, table_body_hlines_color=None, table_body_vlines_style=None, table_body_vlines_width=None, table_body_vlines_color=None, table_body_border_top_style=None, table_body_border_top_width=None, table_body_border_top_color=None, table_body_border_bottom_style=None, table_body_border_bottom_width=None, table_body_border_bottom_color=None, stub_background_color=None, stub_font_size=None, stub_font_weight=None, stub_text_transform=None, stub_border_style=None, stub_border_width=None, stub_border_color=None, stub_row_group_font_size=None, stub_row_group_font_weight=None, stub_row_group_text_transform=None, stub_row_group_border_style=None, stub_row_group_border_width=None, stub_row_group_border_color=None, data_row_padding=None, data_row_padding_horizontal=None, source_notes_background_color=None, source_notes_font_size=None, source_notes_padding=None, source_notes_padding_horizontal=None, source_notes_border_bottom_style=None, source_notes_border_bottom_width=None, source_notes_border_bottom_color=None, source_notes_border_lr_style=None, source_notes_border_lr_width=None, source_notes_border_lr_color=None, source_notes_multiline=None, source_notes_sep=None, row_striping_background_color=None, row_striping_include_stub=None, row_striping_include_table_body=None)\nModify the table output options.\nModify the options available in a table. These options are named by the components, the subcomponents, and the element that can adjusted.\n\nParameters\n\n\n\n\n\n\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\ncontainer_width\nstr | None\nThe width of the table’s container. Can be specified as a single-length character with units of pixels or as a percentage. If provided as a scalar numeric value, it is assumed that the value is given in units of pixels.\nNone\n\n\ncontainer_height\nstr | None\nThe height of the table’s container.\nNone\n\n\ncontainer_overflow_x\nstr | None\nAn option to enable scrolling in the horizontal direction when the table content overflows the container dimensions. Using True (the default) means that horizontal scrolling is enabled to view the entire table in those directions. With False, the table may be clipped if the table width or height exceeds the container_width.\nNone\n\n\ncontainer_overflow_y\nstr | None\nAn option to enable scrolling in the vertical direction when the table content overflows. Same rules apply as for container_overflow_x; the dependency here is that of the table height (container_height).\nNone\n\n\ntable_width\nstr | None\nThe width of the table. Can be specified as a string with units of pixels or as a percentage. If provided as a numeric value, it is assumed that the value is given in units of pixels.\nNone\n\n\ntable_layout\nstr | None\nThe value for the table-layout CSS style in the HTML output context. By default, this is \"fixed\" but another valid option is \"auto\".\nNone\n\n\ntable_margin_left\nstr | None\nThe size of the margins on the left of the table within the container. Can be specified as a single-length value with units of pixels or as a percentage. If provided as a numeric value, it is assumed that the value is given in units of pixels. Using table_margin_left will overwrite any values set by table_align.\nNone\n\n\ntable_margin_right\nstr | None\nThe size of the margins on the right of the table within the container. Same rules apply as for table_margin_left. Using table_margin_right will overwrite any values set by table_align.\nNone\n\n\ntable_background_color\nstr | None\nThe background color for the table. A color name or a hexadecimal color code should be provided.\nNone\n\n\ntable_additional_css\nlist[str] | None\nAdditional CSS that can be added to the table. This can be used to add any custom CSS that is not covered by the other options.\nNone\n\n\ntable_font_names\nstr | list[str] | None\nThe names of the fonts used for the table. This should be provided as a list of font names. If the first font isn’t available, then the next font is tried (and so on).\nNone\n\n\ntable_font_size\nstr | None\nThe font size for the table. Can be specified as a string with units of pixels or as a percentage. If provided as a numeric value, it is assumed that the value is given in units of pixels.\nNone\n\n\ntable_font_weight\nstr | int | float | None\nThe font weight of the table. Can be a text-based keyword such as \"normal\", \"bold\", \"lighter\", \"bolder\", or, a numeric value between 1 and 1000, inclusive. Note that only variable fonts may support the numeric mapping of weight.\nNone\n\n\ntable_font_style\nstr | None\nThe font style for the table. Can be one of either \"normal\", \"italic\", or \"oblique\".\nNone\n\n\ntable_font_color\nstr | None\nThe text color used throughout the table. A color name or a hexadecimal color code should be provided.\nNone\n\n\ntable_font_color_light\nstr | None\nThe text color used throughout the table when the background color is dark. A color name or a hexadecimal color code should be provided.\nNone\n\n\ntable_border_top_style\nstr | None\nThe style of the table’s absolute top border. Can be one of either \"solid\", \"dotted\", \"dashed\", \"double\", \"groove\", \"ridge\", \"inset\", or \"outset\".\nNone\n\n\ntable_border_top_width\nstr | None\nThe width of the table’s absolute top border. Can be specified as a string with units of pixels or as a percentage. If provided as a numeric value, it is assumed that the value is given in units of pixels.\nNone\n\n\ntable_border_top_color\nstr | None\nThe color of the table’s absolute top border. A color name or a hexadecimal color code should be provided.\nNone\n\n\ntable_border_bottom_style\nstr | None\nThe style of the table’s absolute bottom border.\nNone\n\n\ntable_border_bottom_width\nstr | None\nThe width of the table’s absolute bottom border.\nNone\n\n\ntable_border_bottom_color\nstr | None\nThe color of the table’s absolute bottom border.\nNone\n\n\ntable_border_left_style\nstr | None\nThe style of the table’s absolute left border.\nNone\n\n\ntable_border_left_width\nstr | None\nThe width of the table’s absolute left border.\nNone\n\n\ntable_border_left_color\nstr | None\nThe color of the table’s absolute left border.\nNone\n\n\ntable_border_right_style\nstr | None\nThe style of the table’s absolute right border.\nNone\n\n\ntable_border_right_width\nstr | None\nThe width of the table’s absolute right border.\nNone\n\n\ntable_border_right_color\nstr | None\nThe color of the table’s absolute right border.\nNone\n\n\nheading_background_color\nstr | None\nThe background color for the heading. A color name or a hexadecimal color code should be provided.\nNone\n\n\nheading_align\nstr | None\nControls the horizontal alignment of the heading title and subtitle. We can either use \"center\", \"left\", or \"right\".\nNone\n\n\nheading_title_font_size\nstr | None\nThe font size for the heading title element.\nNone\n\n\nheading_title_font_weight\nstr | int | float | None\nThe font weight of the heading title.\nNone\n\n\nheading_subtitle_font_size\nstr | None\nThe font size for the heading subtitle element.\nNone\n\n\nheading_subtitle_font_weight\nstr | int | float | None\nThe font weight of the heading subtitle.\nNone\n\n\nheading_padding\nstr | None\nThe amount of vertical padding to incorporate in the heading (title and subtitle). Can be specified as a string with units of pixels or as a percentage. If provided as a numeric value, it is assumed that the value is given in units of pixels.\nNone\n\n\nheading_padding_horizontal\nstr | None\nThe amount of horizontal padding to incorporate in the heading (title and subtitle). Can be specified as a string with units of pixels or as a percentage. If provided as a numeric value, it is assumed that the value is given in units of pixels.\nNone\n\n\nheading_border_bottom_style\nstr | None\nThe style of the header’s bottom border.\nNone\n\n\nheading_border_bottom_width\nstr | None\nThe width of the header’s bottom border. If the width of this border is larger, then it will be the visible border.\nNone\n\n\nheading_border_bottom_color\nstr | None\nThe color of the header’s bottom border.\nNone\n\n\nheading_border_lr_style\nstr | None\nThe style of the left and right borders of the heading location.\nNone\n\n\nheading_border_lr_width\nstr | None\nThe width of the left and right borders of the heading location. If the width of this border is larger, then it will be the visible border.\nNone\n\n\nheading_border_lr_color\nstr | None\nThe color of the left and right borders of the heading location.\nNone\n\n\ncolumn_labels_background_color\nstr | None\nThe background color for the column labels. A color name or a hexadecimal color code should be provided.\nNone\n\n\ncolumn_labels_font_size\nstr | None\nThe font size to use for all column labels.\nNone\n\n\ncolumn_labels_font_weight\nstr | int | float | None\nThe font weight of the table’s column labels.\nNone\n\n\ncolumn_labels_text_transform\nstr | None\nThe text transformation for the column labels. Either of the \"uppercase\", \"lowercase\", or \"capitalize\" keywords can be used.\nNone\n\n\ncolumn_labels_padding\nstr | None\nThe amount of vertical padding to incorporate in the column_labels (this includes the column spanners).\nNone\n\n\ncolumn_labels_padding_horizontal\nstr | None\nThe amount of horizontal padding to incorporate in the column_labels (this includes the column spanners).\nNone\n\n\ncolumn_labels_vlines_style\nstr | None\nThe style of all vertical lines (‘vlines’) of the column_labels.\nNone\n\n\ncolumn_labels_vlines_width\nstr | None\nThe width of all vertical lines (‘vlines’) of the column_labels.\nNone\n\n\ncolumn_labels_vlines_color\nstr | None\nThe color of all vertical lines (‘vlines’) of the column_labels.\nNone\n\n\ncolumn_labels_border_top_style\nstr | None\nThe style of the top border of the column_labels location.\nNone\n\n\ncolumn_labels_border_top_width\nstr | None\nThe width of the top border of the column_labels location. If the width of this border is larger, then it will be the visible border.\nNone\n\n\ncolumn_labels_border_top_color\nstr | None\nThe color of the top border of the column_labels location.\nNone\n\n\ncolumn_labels_border_bottom_style\nstr | None\nThe style of the bottom border of the column_labels location.\nNone\n\n\ncolumn_labels_border_bottom_width\nstr | None\nThe width of the bottom border of the column_labels location. If the width of this border is larger, then it will be the visible border.\nNone\n\n\ncolumn_labels_border_bottom_color\nstr | None\nThe color of the bottom border of the column_labels location.\nNone\n\n\ncolumn_labels_border_lr_style\nstr | None\nThe style of the left and right borders of the column_labels location.\nNone\n\n\ncolumn_labels_border_lr_width\nstr | None\nThe width of the left and right borders of the column_labels location. If the width of this border is larger, then it will be the visible border.\nNone\n\n\ncolumn_labels_border_lr_color\nstr | None\nThe color of the left and right borders of the column_labels location.\nNone\n\n\ncolumn_labels_hidden\nbool | None\nAn option to hide the column labels. If providing True then the entire column_labels location won’t be seen and the table header (if present) will collapse downward.\nNone\n\n\nrow_group_background_color\nstr | None\nThe background color for the row group labels. A color name or a hexadecimal color code should be provided.\nNone\n\n\nrow_group_font_weight\nstr | int | float | None\nThe font weight for all row group labels present in the table.\nNone\n\n\nrow_group_font_size\nstr | None\nThe font size to use for all row group labels.\nNone\n\n\nrow_group_padding\nstr | None\nThe amount of vertical padding to incorporate in the row group labels.\nNone\n\n\nrow_group_border_top_style\nstr | None\nThe style of the top border of the row_group location.\nNone\n\n\nrow_group_border_top_width\nstr | None\nThe width of the top border of the row_group location. If the width of this border is larger, then it will be the visible border.\nNone\n\n\nrow_group_border_top_color\nstr | None\nThe color of the top border of the row_group location.\nNone\n\n\nrow_group_border_bottom_style\nstr | None\nThe style of the bottom border of the row_group location.\nNone\n\n\nrow_group_border_bottom_width\nstr | None\nThe width of the bottom border of the row_group location. If the width of this border is larger, then it will be the visible border.\nNone\n\n\nrow_group_border_bottom_color\nstr | None\nThe color of the bottom border of the row_group location.\nNone\n\n\nrow_group_border_left_style\nstr | None\nThe style of the left border of the row_group location.\nNone\n\n\nrow_group_border_left_width\nstr | None\nThe width of the left border of the row_group location. If the width of this border is larger, then it will be the visible border.\nNone\n\n\nrow_group_border_left_color\nstr | None\nThe color of the left border of the row_group location.\nNone\n\n\nrow_group_border_right_style\nstr | None\nThe style of the right border of the row_group location.\nNone\n\n\nrow_group_border_right_width\nstr | None\nThe width of the right border of the row_group location. If the width of this border is\nNone\n\n\nrow_group_border_right_color\nstr | None\nThe color of the right border of the row_group location.\nNone\n\n\nrow_group_as_column\nbool | None\nAn option to render the row group labels as a column. If True, then the row group labels will be rendered as a column to the left of the table body. If False, then the row group labels will be rendered as a separate row above the grouping of rows.\nNone\n\n\ntable_body_hlines_style\nstr | None\nThe style of all horizontal lines (‘hlines’) in the table_body.\nNone\n\n\ntable_body_hlines_width\nstr | None\nThe width of all horizontal lines (‘hlines’) in the table_body.\nNone\n\n\ntable_body_hlines_color\nstr | None\nThe color of all horizontal lines (‘hlines’) in the table_body.\nNone\n\n\ntable_body_vlines_style\nstr | None\nThe style of all vertical lines (‘vlines’) in the table_body.\nNone\n\n\ntable_body_vlines_width\nstr | None\nThe width of all vertical lines (‘vlines’) in the table_body.\nNone\n\n\ntable_body_vlines_color\nstr | None\nThe color of all vertical lines (‘vlines’) in the table_body.\nNone\n\n\ntable_body_border_top_style\nstr | None\nThe style of the top border of the table_body location.\nNone\n\n\ntable_body_border_top_width\nstr | None\nThe width of the top border of the table_body location. If the width of this border is larger, then it will be the visible border.\nNone\n\n\ntable_body_border_top_color\nstr | None\nThe color of the top border of the table_body location.\nNone\n\n\ntable_body_border_bottom_style\nstr | None\nThe style of the bottom border of the table_body location.\nNone\n\n\ntable_body_border_bottom_width\nstr | None\nThe width of the bottom border of the table_body location. If the width of this border\nNone\n\n\ntable_body_border_bottom_color\nstr | None\nThe color of the bottom border of the table_body location.\nNone\n\n\nstub_background_color\nstr | None\nThe background color for the stub. A color name or a hexadecimal color code should be provided.\nNone\n\n\nstub_font_size\nstr | None\nThe font size to use for all row labels present in the table stub.\nNone\n\n\nstub_font_weight\nstr | int | float | None\nThe font weight for all row labels present in the table stub.\nNone\n\n\nstub_text_transform\nstr | None\nThe text transformation for the row labels present in the table stub.\nNone\n\n\nstub_border_style\nstr | None\nThe style of the vertical border of the table stub.\nNone\n\n\nstub_border_width\nstr | None\nThe width of the vertical border of the table stub.\nNone\n\n\nstub_border_color\nstr | None\nThe color of the vertical border of the table stub.\nNone\n\n\nstub_row_group_font_size\nstr | None\nThe font size for the row group column in the stub.\nNone\n\n\nstub_row_group_font_weight\nstr | int | float | None\nThe font weight for the row group column in the stub.\nNone\n\n\nstub_row_group_text_transform\nstr | None\nThe text transformation for the row group column in the stub.\nNone\n\n\nstub_row_group_border_style\nstr | None\nThe style of the vertical border of the row group column in the stub.\nNone\n\n\nstub_row_group_border_width\nstr | None\nThe width of the vertical border of the row group column in the stub.\nNone\n\n\nstub_row_group_border_color\nstr | None\nThe color of the vertical border of the row group column in the stub.\nNone\n\n\ndata_row_padding\nstr | None\nThe amount of vertical padding to incorporate in the body/stub rows.\nNone\n\n\ndata_row_padding_horizontal\nstr | None\nThe amount of horizontal padding to incorporate in the body/stub rows.\nNone\n\n\nsource_notes_background_color\nstr | None\nThe background color for the source notes. A color name or a hexadecimal color code should be provided.\nNone\n\n\nsource_notes_font_size\nstr | None\nThe font size to use for all source note text.\nNone\n\n\nsource_notes_padding\nstr | None\nThe amount of vertical padding to incorporate in the source notes.\nNone\n\n\nsource_notes_padding_horizontal\nstr | None\nThe amount of horizontal padding to incorporate in the source notes.\nNone\n\n\nsource_notes_multiline\nbool | None\nAn option to either put source notes in separate lines (the default, or True) or render them as a continuous line of text with source_notes_sep providing the separator (by default \" \") between notes.\nNone\n\n\nsource_notes_sep\nstr | None\nThe separating characters between adjacent source notes when rendered as a continuous line of text (when source_notes_multiline is False). The default value is a single space character (\" \").\nNone\n\n\nsource_notes_border_bottom_style\nstr | None\nThe style of the bottom border of the source_notes location.\nNone\n\n\nsource_notes_border_bottom_width\nstr | None\nThe width of the bottom border of the source_notes location. If the width of this border is larger, then it will be the visible border.\nNone\n\n\nsource_notes_border_bottom_color\nstr | None\nThe color of the bottom border of the source_notes location.\nNone\n\n\nsource_notes_border_lr_style\nstr | None\nThe style of the left and right borders of the source_notes location.\nNone\n\n\nsource_notes_border_lr_width\nstr | None\nThe width of the left and right borders of the source_notes location. If the width of this border is larger, then it will be the visible border.\nNone\n\n\nsource_notes_border_lr_color\nstr | None\nThe color of the left and right borders of the source_notes location.\nNone\n\n\nrow_striping_background_color\nstr | None\nThe background color for striped table body rows. A color name or a hexadecimal color code should be provided.\nNone\n\n\nrow_striping_include_stub\nbool | None\nAn option for whether to include the stub when striping rows.\nNone\n\n\nrow_striping_include_table_body\nbool | None\nAn option for whether to include the table body when striping rows.\nNone\n\n\n\n\n\nReturns\n\n\n\nType\nDescription\n\n\n\n\nGT\nThe GT object is returned. This is the same object that the method is called on so that we can facilitate method chaining.\n\n\n\n\n\nExamples\nUsing select columns from the exibble dataset, let’s create a new table with a number of table components added. We can use this object going forward to demonstrate some of the features available in the tab_options() method.\n\nfrom great_tables import GT, exibble, md\n\ngt_tbl = (\n GT(\n exibble[[\"num\", \"char\", \"currency\", \"row\", \"group\"]],\n rowname_col=\"row\",\n groupname_col=\"group\"\n )\n .tab_header(\n title=md(\"Data listing from **exibble**\"),\n subtitle=md(\"`exibble` is a **Great Tables** dataset.\")\n )\n .fmt_number(columns=\"num\")\n .fmt_currency(columns=\"currency\")\n .tab_source_note(source_note=\"This is only a subset of the dataset.\")\n)\n\ngt_tbl\n\n\n\n\n\n\n \n Data listing from exibble\n \n \n exibble is a Great Tables dataset.\n \n\n \n num\n char\n currency\n\n\n\n \n grp_a\n \n \n row_1\n 0.11\n apricot\n $49.95\n \n \n row_2\n 2.22\n banana\n $17.95\n \n \n row_3\n 33.33\n coconut\n $1.39\n \n \n row_4\n 444.40\n durian\n $65,100.00\n \n \n grp_b\n \n \n row_5\n 5,550.00\n \n $1,325.81\n \n \n row_6\n \n fig\n $13.26\n \n \n row_7\n 777,000.00\n grapefruit\n \n \n \n row_8\n 8,880,000.00\n honeydew\n $0.44\n \n\n \n \n \n This is only a subset of the dataset.\n \n\n\n\n\n\n\n \n\n\nWe can modify the table width to be set as \"100%“. In effect, this spans the table to entirely fill the content width area. This is done with the table_width option.\n\ngt_tbl.tab_options(table_width=\"100%\")\n\n\n\n\n\n\n \n Data listing from exibble\n \n \n exibble is a Great Tables dataset.\n \n\n \n num\n char\n currency\n\n\n\n \n grp_a\n \n \n row_1\n 0.11\n apricot\n $49.95\n \n \n row_2\n 2.22\n banana\n $17.95\n \n \n row_3\n 33.33\n coconut\n $1.39\n \n \n row_4\n 444.40\n durian\n $65,100.00\n \n \n grp_b\n \n \n row_5\n 5,550.00\n \n $1,325.81\n \n \n row_6\n \n fig\n $13.26\n \n \n row_7\n 777,000.00\n grapefruit\n \n \n \n row_8\n 8,880,000.00\n honeydew\n $0.44\n \n\n \n \n \n This is only a subset of the dataset.\n \n\n\n\n\n\n\n \n\n\nWith the table_background_color option, we can modify the table’s background color. Here, we want that to be \"lightcyan\".\n\ngt_tbl.tab_options(table_background_color=\"lightcyan\")\n\n\n\n\n\n\n \n Data listing from exibble\n \n \n exibble is a Great Tables dataset.\n \n\n \n num\n char\n currency\n\n\n\n \n grp_a\n \n \n row_1\n 0.11\n apricot\n $49.95\n \n \n row_2\n 2.22\n banana\n $17.95\n \n \n row_3\n 33.33\n coconut\n $1.39\n \n \n row_4\n 444.40\n durian\n $65,100.00\n \n \n grp_b\n \n \n row_5\n 5,550.00\n \n $1,325.81\n \n \n row_6\n \n fig\n $13.26\n \n \n row_7\n 777,000.00\n grapefruit\n \n \n \n row_8\n 8,880,000.00\n honeydew\n $0.44\n \n\n \n \n \n This is only a subset of the dataset.\n \n\n\n\n\n\n\n \n\n\nThe data rows of a table typically take up the most physical space but we have some control over the extent of that. With the data_row_padding option, it’s possible to modify the top and bottom padding of data rows. We’ll do just that in the following example, reducing the padding to a value of \"3px\".\n\ngt_tbl.tab_options(data_row_padding=\"3px\")\n\n\n\n\n\n\n \n Data listing from exibble\n \n \n exibble is a Great Tables dataset.\n \n\n \n num\n char\n currency\n\n\n\n \n grp_a\n \n \n row_1\n 0.11\n apricot\n $49.95\n \n \n row_2\n 2.22\n banana\n $17.95\n \n \n row_3\n 33.33\n coconut\n $1.39\n \n \n row_4\n 444.40\n durian\n $65,100.00\n \n \n grp_b\n \n \n row_5\n 5,550.00\n \n $1,325.81\n \n \n row_6\n \n fig\n $13.26\n \n \n row_7\n 777,000.00\n grapefruit\n \n \n \n row_8\n 8,880,000.00\n honeydew\n $0.44\n \n\n \n \n \n This is only a subset of the dataset.\n \n\n\n\n\n\n\n \n\n\nThe size of the title and the subtitle text in the header of the table can be altered with the heading_title_font_size and heading_subtitle_font_size options. Here, we’ll use the \"small\" and \"x-small\" keyword values.\n\ngt_tbl.tab_options(heading_title_font_size=\"small\", heading_subtitle_font_size=\"x-small\")\n\n\n\n\n\n\n \n Data listing from exibble\n \n \n exibble is a Great Tables dataset.\n \n\n \n num\n char\n currency\n\n\n\n \n grp_a\n \n \n row_1\n 0.11\n apricot\n $49.95\n \n \n row_2\n 2.22\n banana\n $17.95\n \n \n row_3\n 33.33\n coconut\n $1.39\n \n \n row_4\n 444.40\n durian\n $65,100.00\n \n \n grp_b\n \n \n row_5\n 5,550.00\n \n $1,325.81\n \n \n row_6\n \n fig\n $13.26\n \n \n row_7\n 777,000.00\n grapefruit\n \n \n \n row_8\n 8,880,000.00\n honeydew\n $0.44\n \n\n \n \n \n This is only a subset of the dataset.\n \n\n\n\n\n\n\n \n\n\n\n\n\ntab_source_note\nGT.tab_source_note(self, source_note)\nAdd a source note citation.\nAdd a source note to the footer part of the table. A source note is useful for citing the data included in the table. Several can be added to the footer, simply use the tab_source_note() method multiple times and they will be inserted in the order provided. We can use Markdown formatting for the note, or, if the table is intended for HTML output, we can include HTML formatting.\n\nParameters\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\nsource_note\nstr | Text\nText to be used in the source note. We can optionally use the md() or html() helper functions to style the text as Markdown or to retain HTML elements in the text.\nrequired\n\n\n\n\n\nReturns\n\n\n\nType\nDescription\n\n\n\n\nGT\nThe GT object is returned. This is the same object that the method is called on so that we can facilitate method chaining.\n\n\n\n\n\nExamples\nWith three columns from the gtcars dataset, let’s create a new table. We can use the tab_source_note() method to add a source note to the table footer. Here we are citing the data source but this method can be used for any text you’d prefer to display in the footer component of the table.\n\nfrom great_tables import GT\nfrom great_tables.data import gtcars\n\ngtcars_mini = gtcars[[\"mfr\", \"model\", \"msrp\"]].head(5)\n\n(\n GT(gtcars_mini, rowname_col=\"model\")\n .tab_source_note(source_note=\"From edmunds.com\")\n)\n\n\n\n\n\n\n\n \n mfr\n msrp\n\n\n\n \n GT\n Ford\n 447000.0\n \n \n 458 Speciale\n Ferrari\n 291744.0\n \n \n 458 Spider\n Ferrari\n 263553.0\n \n \n 458 Italia\n Ferrari\n 233509.0\n \n \n 488 GTB\n Ferrari\n 245400.0\n \n\n \n \n \n From edmunds.com\n \n\n\n\n\n\n\n \n\n\n\n\n\ntab_spanner\nGT.tab_spanner(self, label, columns=None, spanners=None, level=None, id=None, gather=True, replace=False)\nInsert a spanner above a selection of column headings.\nThis part of the table contains, at a minimum, column labels and, optionally, an unlimited number of levels for spanners. A spanner will occupy space over any number of contiguous column labels and it will have an associated label and ID value. This method allows for mapping to be defined by column names, existing spanner ID values, or a mixture of both.\nThe spanners are placed in the order of calling tab_spanner() so if a later call uses the same columns in its definition (or even a subset) as the first invocation, the second spanner will be overlaid atop the first. Options exist for forcibly inserting a spanner underneath others (with level as space permits) and with replace, which allows for full or partial spanner replacement.\n\nParameters\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\nlabel\nstr | Text\nThe text to use for the spanner label. We can optionally use the md() and html() helper functions to style the text as Markdown or to retain HTML elements in the text. Alternatively, units notation can be used (see define_units() for details).\nrequired\n\n\ncolumns\nSelectExpr\nThe columns to target. Can either be a single column name or a series of column names provided in a list.\nNone\n\n\nspanners\nstr | list[str] | None\nThe spanners that should be spanned over, should they already be defined. One or more spanner ID values (in quotes) can be supplied here. This argument works in tandem with the columns argument.\nNone\n\n\nlevel\nint | None\nAn explicit level to which the spanner should be placed. If not provided, Great Tables will choose the level based on the inputs provided within columns and spanners, placing the spanner label where it will fit. The first spanner level (right above the column labels) is 0.\nNone\n\n\nid\nstr | None\nThe ID for the spanner. When accessing a spanner through the spanners argument of tab_spanner() the id value is used as the reference (and not the label). If an id is not explicitly provided here, it will be taken from the label value. It is advisable to set an explicit id value if you plan to access this cell in a later call and the label text is complicated (e.g., contains markup, is lengthy, or both). Finally, when providing an id value you must ensure that it is unique across all ID values set for spanner labels (the method will throw an error if id isn’t unique).\nNone\n\n\ngather\nbool\nAn option to move the specified columns such that they are unified under the spanner. Ordering of the moved-into-place columns will be preserved in all cases. By default, this is set to True.\nTrue\n\n\nreplace\nbool\nShould new spanners be allowed to partially or fully replace existing spanners? (This is a possibility if setting spanners at an already populated level.) By default, this is set to False and an error will occur if some replacement is attempted.\nFalse\n\n\n\n\n\nReturns\n\n\n\nType\nDescription\n\n\n\n\nGT\nThe GT object is returned. This is the same object that the method is called on so that we can facilitate method chaining.\n\n\n\n\n\nExamples\nLet’s create a table using a small portion of the gtcars dataset. Over several columns (hp, hp_rpm, trq, trq_rpm, mpg_c, mpg_h) we’ll use tab_spanner() to add a spanner with the label \"performance\". This effectively groups together several columns related to car performance under a unifying label.\n\nfrom great_tables import GT\nfrom great_tables.data import gtcars\n\ncolnames = [\"model\", \"hp\", \"hp_rpm\", \"trq\", \"trq_rpm\", \"mpg_c\", \"mpg_h\"]\ngtcars_mini = gtcars[colnames].head(10)\n\n(\n GT(gtcars_mini)\n .tab_spanner(\n label=\"performance\",\n columns=[\"hp\", \"hp_rpm\", \"trq\", \"trq_rpm\", \"mpg_c\", \"mpg_h\"]\n )\n)\n\n\n\n\n\n\n\n model\n \n performance\n \n\n\n hp\n hp_rpm\n trq\n trq_rpm\n mpg_c\n mpg_h\n\n\n\n \n GT\n 647.0\n 6250.0\n 550.0\n 5900.0\n 11.0\n 18.0\n \n \n 458 Speciale\n 597.0\n 9000.0\n 398.0\n 6000.0\n 13.0\n 17.0\n \n \n 458 Spider\n 562.0\n 9000.0\n 398.0\n 6000.0\n 13.0\n 17.0\n \n \n 458 Italia\n 562.0\n 9000.0\n 398.0\n 6000.0\n 13.0\n 17.0\n \n \n 488 GTB\n 661.0\n 8000.0\n 561.0\n 3000.0\n 15.0\n 22.0\n \n \n California\n 553.0\n 7500.0\n 557.0\n 4750.0\n 16.0\n 23.0\n \n \n GTC4Lusso\n 680.0\n 8250.0\n 514.0\n 5750.0\n 12.0\n 17.0\n \n \n FF\n 652.0\n 8000.0\n 504.0\n 6000.0\n 11.0\n 16.0\n \n \n F12Berlinetta\n 731.0\n 8250.0\n 509.0\n 6000.0\n 11.0\n 16.0\n \n \n LaFerrari\n 949.0\n 9000.0\n 664.0\n 6750.0\n 12.0\n 16.0\n \n\n\n\n\n\n\n \n\n\nWe can also use Markdown formatting for the spanner label. In this example, we’ll use gt.md(\"*Performance*\") to make the label italicized.\n\nfrom great_tables import GT, md\nfrom great_tables.data import gtcars\n\ncolnames = [\"model\", \"hp\", \"hp_rpm\", \"trq\", \"trq_rpm\", \"mpg_c\", \"mpg_h\"]\ngtcars_mini = gtcars[colnames].head(10)\n\n(\n GT(gtcars_mini)\n .tab_spanner(\n label=md(\"*Performance*\"),\n columns=[\"hp\", \"hp_rpm\", \"trq\", \"trq_rpm\", \"mpg_c\", \"mpg_h\"]\n )\n)\n\n\n\n\n\n\n\n model\n \n Performance\n \n\n\n hp\n hp_rpm\n trq\n trq_rpm\n mpg_c\n mpg_h\n\n\n\n \n GT\n 647.0\n 6250.0\n 550.0\n 5900.0\n 11.0\n 18.0\n \n \n 458 Speciale\n 597.0\n 9000.0\n 398.0\n 6000.0\n 13.0\n 17.0\n \n \n 458 Spider\n 562.0\n 9000.0\n 398.0\n 6000.0\n 13.0\n 17.0\n \n \n 458 Italia\n 562.0\n 9000.0\n 398.0\n 6000.0\n 13.0\n 17.0\n \n \n 488 GTB\n 661.0\n 8000.0\n 561.0\n 3000.0\n 15.0\n 22.0\n \n \n California\n 553.0\n 7500.0\n 557.0\n 4750.0\n 16.0\n 23.0\n \n \n GTC4Lusso\n 680.0\n 8250.0\n 514.0\n 5750.0\n 12.0\n 17.0\n \n \n FF\n 652.0\n 8000.0\n 504.0\n 6000.0\n 11.0\n 16.0\n \n \n F12Berlinetta\n 731.0\n 8250.0\n 509.0\n 6000.0\n 11.0\n 16.0\n \n \n LaFerrari\n 949.0\n 9000.0\n 664.0\n 6750.0\n 12.0\n 16.0\n \n\n\n\n\n\n\n \n\n\n\n\n\ntab_stub\nGT.tab_stub(self, rowname_col=None, groupname_col=None)\nAdd a table stub, to emphasize row and group information.\n\nParameters\n\n\n\n\n\n\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\nrowname_col\nstr | None\nThe column to use for row names. By default, no row names added.\nNone\n\n\ngroupname_col\nstr | None\nThe column to use for group names. By default no group names added.\nNone\n\n\n\n\n\nExamples\nBy default, all data is together in the body of the table.\n\nfrom great_tables import GT, exibble\n\nGT(exibble)\n\n\n\n\n\n\n\n num\n char\n fctr\n date\n time\n datetime\n currency\n row\n group\n\n\n\n \n 0.1111\n apricot\n one\n 2015-01-15\n 13:35\n 2018-01-01 02:22\n 49.95\n row_1\n grp_a\n \n \n 2.222\n banana\n two\n 2015-02-15\n 14:40\n 2018-02-02 14:33\n 17.95\n row_2\n grp_a\n \n \n 33.33\n coconut\n three\n 2015-03-15\n 15:45\n 2018-03-03 03:44\n 1.39\n row_3\n grp_a\n \n \n 444.4\n durian\n four\n 2015-04-15\n 16:50\n 2018-04-04 15:55\n 65100.0\n row_4\n grp_a\n \n \n 5550.0\n \n five\n 2015-05-15\n 17:55\n 2018-05-05 04:00\n 1325.81\n row_5\n grp_b\n \n \n \n fig\n six\n 2015-06-15\n \n 2018-06-06 16:11\n 13.255\n row_6\n grp_b\n \n \n 777000.0\n grapefruit\n seven\n \n 19:10\n 2018-07-07 05:22\n \n row_7\n grp_b\n \n \n 8880000.0\n honeydew\n eight\n 2015-08-15\n 20:20\n \n 0.44\n row_8\n grp_b\n \n\n\n\n\n\n\n \n\n\nThe table stub separates row names with a vertical line, and puts group names on their own line.\n\nGT(exibble).tab_stub(rowname_col=\"row\", groupname_col=\"group\")\n\n\n\n\n\n\n\n \n num\n char\n fctr\n date\n time\n datetime\n currency\n\n\n\n \n grp_a\n \n \n row_1\n 0.1111\n apricot\n one\n 2015-01-15\n 13:35\n 2018-01-01 02:22\n 49.95\n \n \n row_2\n 2.222\n banana\n two\n 2015-02-15\n 14:40\n 2018-02-02 14:33\n 17.95\n \n \n row_3\n 33.33\n coconut\n three\n 2015-03-15\n 15:45\n 2018-03-03 03:44\n 1.39\n \n \n row_4\n 444.4\n durian\n four\n 2015-04-15\n 16:50\n 2018-04-04 15:55\n 65100.0\n \n \n grp_b\n \n \n row_5\n 5550.0\n \n five\n 2015-05-15\n 17:55\n 2018-05-05 04:00\n 1325.81\n \n \n row_6\n \n fig\n six\n 2015-06-15\n \n 2018-06-06 16:11\n 13.255\n \n \n row_7\n 777000.0\n grapefruit\n seven\n \n 19:10\n 2018-07-07 05:22\n \n \n \n row_8\n 8880000.0\n honeydew\n eight\n 2015-08-15\n 20:20\n \n 0.44\n \n\n\n\n\n\n\n \n\n\n\n\n\ntab_stubhead\nGT.tab_stubhead(self, label)\nAdd label text to the stubhead.\nAdd a label to the stubhead of a table. The stubhead is the lone element that is positioned left of the column labels, and above the stub. If a stub does not exist, then there is no stubhead (so no change will be made when using this method in that case). We have the flexibility to use Markdown formatting for the stubhead label (through use of the md() helper function). Furthermore, we can use HTML for the stubhead label so long as we also use the html() helper function.\n\nParameters\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\nlabel\nstr | Text\nThe text to be used as the stubhead label. We can optionally use the md() and html() helper functions to style the text as Markdown or to retain HTML elements in the text.\nrequired\n\n\n\n\n\nReturns\n\n\n\nType\nDescription\n\n\n\n\nGT\nThe GT object is returned. This is the same object that the method is called on so that we can facilitate method chaining.\n\n\n\n\n\nExamples\nUsing a small subset of the gtcars dataset, we can create a table with row labels. Since we have row labels in the stub (via use of rowname_col=\"model\" in the GT() call) we have a stubhead, so, let’s add a stubhead label (\"car\") with the tab_stubhead() method to describe what’s in the stub.\n\nfrom great_tables import GT\nfrom great_tables.data import gtcars\n\ngtcars_mini = gtcars[[\"model\", \"year\", \"hp\", \"trq\"]].head(5)\n\n(\n GT(gtcars_mini, rowname_col=\"model\")\n .tab_stubhead(label=\"car\")\n)\n\n\n\n\n\n\n\n car\n year\n hp\n trq\n\n\n\n \n GT\n 2017.0\n 647.0\n 550.0\n \n \n 458 Speciale\n 2015.0\n 597.0\n 398.0\n \n \n 458 Spider\n 2015.0\n 562.0\n 398.0\n \n \n 458 Italia\n 2014.0\n 562.0\n 398.0\n \n \n 488 GTB\n 2016.0\n 661.0\n 561.0\n \n\n\n\n\n\n\n \n\n\nWe can also use Markdown formatting for the stubhead label. In this example, we’ll use md(\"*Car*\") to make the label italicized.\n\nfrom great_tables import GT, md\nfrom great_tables.data import gtcars\n\n(\n GT(gtcars_mini, rowname_col=\"model\")\n .tab_stubhead(label=md(\"*Car*\"))\n)\n\n\n\n\n\n\n\n Car\n year\n hp\n trq\n\n\n\n \n GT\n 2017.0\n 647.0\n 550.0\n \n \n 458 Speciale\n 2015.0\n 597.0\n 398.0\n \n \n 458 Spider\n 2015.0\n 562.0\n 398.0\n \n \n 458 Italia\n 2014.0\n 562.0\n 398.0\n \n \n 488 GTB\n 2016.0\n 661.0\n 561.0\n \n\n\n\n\n\n\n \n\n\n\n\n\ntab_style\nGT.tab_style(self, style, locations)\nAdd custom style to one or more cells\nWith the tab_style() method we can target specific cells and apply styles to them. We do this with the combination of the style and location arguments. The style argument requires use of styling classes (e.g., style.fill(color=\"red\")) and the location argument needs to be an expression of the cells we want to target using location targeting classes (e.g., loc.body(columns=<column_name>)). With the available suite of styling classes, here are some of the styles we can apply:\n\nthe background color of the cell (style.fill()’s color)\nthe cell’s text color, font, and size (style.text()’s color, font, and size)\nthe text style (style.text()’s style), enabling the use of italics or oblique text.\nthe text weight (style.text()’s weight), allowing the use of thin to bold text (the degree of choice is greater with variable fonts)\nthe alignment of text (style.text()’s align)\ncell borders with the style.borders() class\n\n\nParameters\n\n\n\n\n\n\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\nstyle\nCellStyle | list[CellStyle]\nThe styles to use for the cells at the targeted locations. The style.text(), style.fill(), and style.borders() classes can be used here to more easily generate valid styles.\nrequired\n\n\nlocations\nLoc | list[Loc]\nThe cell or set of cells to be associated with the style. The loc.body() class can be used here to easily target body cell locations.\nrequired\n\n\n\n\n\nReturns\n\n\n\nType\nDescription\n\n\n\n\nGT\nThe GT object is returned. This is the same object that the method is called on so that we can facilitate method chaining.\n\n\n\n\n\nExamples\nLet’s use a small subset of the exibble dataset to demonstrate how to use tab_style() to target specific cells and apply styles to them. We’ll start by creating the exibble_sm table (a subset of the exibble table) and then use tab_style() to apply a light cyan background color to the cells in the num column for the first two rows of the table. We’ll then apply a larger font size to the cells in the fctr column for the last four rows of the table.\n\nfrom great_tables import GT, style, loc, exibble\n\nexibble_sm = exibble[[\"num\", \"fctr\", \"row\", \"group\"]]\n\n(\n GT(exibble_sm, rowname_col=\"row\", groupname_col=\"group\")\n .tab_style(\n style=style.fill(color=\"lightcyan\"),\n locations=loc.body(columns=\"num\", rows=[\"row_1\", \"row_2\"]),\n )\n .tab_style(\n style=style.text(size=\"22px\"),\n locations=loc.body(columns=[\"fctr\"], rows=[4, 5, 6, 7]),\n )\n)\n\n\n\n\n\n\n\n \n num\n fctr\n\n\n\n \n grp_a\n \n \n row_1\n 0.1111\n one\n \n \n row_2\n 2.222\n two\n \n \n row_3\n 33.33\n three\n \n \n row_4\n 444.4\n four\n \n \n grp_b\n \n \n row_5\n 5550.0\n five\n \n \n row_6\n \n six\n \n \n row_7\n 777000.0\n seven\n \n \n row_8\n 8880000.0\n eight\n \n\n\n\n\n\n\n \n\n\nLet’s use exibble once again to create a simple, two-column output table (keeping only the num and currency columns). With the tab_style() method (called thrice), we’ll add style to the values already formatted by fmt_number() and fmt_currency(). In the style argument of the first two tab_style() call, we can define multiple types of styling with the style.fill() and style.text() classes (enclosing these in a list). The cells to be targeted for styling require the use of loc.body(), which is used here with different columns being targeted. For the final tab_style() call, we demonstrate the use of style.borders() class as the style argument, which is employed in conjunction with loc.body() to locate the row to be styled.\n\nfrom great_tables import GT, style, loc, exibble\n\n(\n GT(exibble[[\"num\", \"currency\"]])\n .fmt_number(columns=\"num\", decimals=1)\n .fmt_currency(columns=\"currency\")\n .tab_style(\n style=[\n style.fill(color=\"lightcyan\"),\n style.text(weight=\"bold\")\n ],\n locations=loc.body(columns=\"num\")\n )\n .tab_style(\n style=[\n style.fill(color=\"#F9E3D6\"),\n style.text(style=\"italic\")\n ],\n locations=loc.body(columns=\"currency\")\n )\n .tab_style(\n style=style.borders(sides=[\"top\", \"bottom\"], weight='2px', color=\"red\"),\n locations=loc.body(rows=[4])\n )\n)\n\n\n\n\n\n\n\n num\n currency\n\n\n\n \n 0.1\n $49.95\n \n \n 2.2\n $17.95\n \n \n 33.3\n $1.39\n \n \n 444.4\n $65,100.00\n \n \n 5,550.0\n $1,325.81\n \n \n \n $13.26\n \n \n 777,000.0\n \n \n \n 8,880,000.0\n $0.44\n \n\n\n\n\n\n\n \n\n\n\n\n\nwith_id\nGT.with_id(self, id=None)\nSet the id for this table.\nNote that this is a shortcut for the table_id= argument in GT.tab_options().\n\n\nwith_locale\nGT.with_locale(self, locale=None)\nSet a column to be the default locale.\nSetting a default locale affects formatters like .fmt_number, and .fmt_date, by having them default to locale-specific features (e.g. representing one thousand as 1.000,00)" }, { "objectID": "reference/data.sza.html", diff --git a/sitemap.xml b/sitemap.xml index 5f66a1d2d..b35a24ea0 100644 --- a/sitemap.xml +++ b/sitemap.xml @@ -2,446 +2,446 @@ https://posit-dev.github.io/great-tables/examples/index.html - 2024-09-30T14:40:35.279Z + 2024-09-30T14:41:06.807Z https://posit-dev.github.io/great-tables/blog/introduction_great_tables.html - 2024-09-30T14:40:35.270Z + 2024-09-30T14:41:06.798Z https://posit-dev.github.io/great-tables/blog/tables-for-scientific-publishing/index.html - 2024-09-30T14:40:35.279Z + 2024-09-30T14:41:06.806Z https://posit-dev.github.io/great-tables/blog/introduction-0.3.0/index.html - 2024-09-30T14:40:35.270Z + 2024-09-30T14:41:06.798Z https://posit-dev.github.io/great-tables/blog/introduction-0.2.0/index.html - 2024-09-30T14:40:35.270Z + 2024-09-30T14:41:06.798Z https://posit-dev.github.io/great-tables/blog/pycon-2024-great-tables-are-possible/index.html - 2024-09-30T14:40:35.271Z + 2024-09-30T14:41:06.799Z https://posit-dev.github.io/great-tables/blog/index.html - 2024-09-30T14:40:35.270Z + 2024-09-30T14:41:06.798Z https://posit-dev.github.io/great-tables/get-started/row-selection.html - 2024-09-30T14:40:35.280Z + 2024-09-30T14:41:06.808Z https://posit-dev.github.io/great-tables/get-started/basic-column-labels.html - 2024-09-30T14:40:35.280Z + 2024-09-30T14:41:06.807Z https://posit-dev.github.io/great-tables/get-started/basic-styling.html - 2024-09-30T14:40:35.280Z + 2024-09-30T14:41:06.807Z https://posit-dev.github.io/great-tables/get-started/table-theme-options.html - 2024-09-30T14:40:35.280Z + 2024-09-30T14:41:06.808Z https://posit-dev.github.io/great-tables/get-started/basic-formatting.html - 2024-09-30T14:40:35.280Z + 2024-09-30T14:41:06.807Z https://posit-dev.github.io/great-tables/get-started/targeted-styles.html - 2024-09-30T14:40:35.281Z + 2024-09-30T14:41:06.808Z https://posit-dev.github.io/great-tables/get-started/basic-stub.html - 2024-09-30T14:40:35.280Z + 2024-09-30T14:41:06.807Z https://posit-dev.github.io/great-tables/reference/GT.sub_zero.html - 2024-09-30T14:41:42.283Z + 2024-09-30T14:43:21.808Z https://posit-dev.github.io/great-tables/reference/GT.tab_options.html - 2024-09-30T14:41:42.072Z + 2024-09-30T14:43:21.605Z https://posit-dev.github.io/great-tables/reference/vals.fmt_time.html - 2024-09-30T14:41:42.592Z + 2024-09-30T14:43:22.108Z https://posit-dev.github.io/great-tables/reference/define_units.html - 2024-09-30T14:41:42.394Z + 2024-09-30T14:43:21.914Z https://posit-dev.github.io/great-tables/reference/google_font.html - 2024-09-30T14:41:42.384Z + 2024-09-30T14:43:21.905Z https://posit-dev.github.io/great-tables/reference/data.metro.html - 2024-09-30T14:41:42.619Z + 2024-09-30T14:43:22.133Z https://posit-dev.github.io/great-tables/reference/GT.cols_label.html - 2024-09-30T14:41:42.302Z + 2024-09-30T14:43:21.826Z https://posit-dev.github.io/great-tables/reference/vals.fmt_markdown.html - 2024-09-30T14:41:42.596Z + 2024-09-30T14:43:22.112Z https://posit-dev.github.io/great-tables/reference/GT.fmt_nanoplot.html - 2024-09-30T14:41:42.248Z + 2024-09-30T14:43:21.776Z https://posit-dev.github.io/great-tables/reference/data.reactions.html - 2024-09-30T14:41:42.627Z + 2024-09-30T14:43:22.141Z https://posit-dev.github.io/great-tables/reference/GT.as_raw_html.html - 2024-09-30T14:41:42.495Z + 2024-09-30T14:43:22.013Z https://posit-dev.github.io/great-tables/reference/GT.html - 2024-09-30T14:41:41.927Z + 2024-09-30T14:43:21.464Z https://posit-dev.github.io/great-tables/reference/data.sza.html - 2024-09-30T14:41:42.601Z + 2024-09-30T14:43:22.117Z https://posit-dev.github.io/great-tables/reference/GT.tab_spanner.html - 2024-09-30T14:41:41.945Z + 2024-09-30T14:43:21.481Z https://posit-dev.github.io/great-tables/reference/GT.tab_style.html - 2024-09-30T14:41:41.967Z + 2024-09-30T14:43:21.503Z https://posit-dev.github.io/great-tables/reference/GT.cols_width.html - 2024-09-30T14:41:42.296Z + 2024-09-30T14:43:21.820Z https://posit-dev.github.io/great-tables/reference/GT.fmt.html - 2024-09-30T14:41:42.256Z + 2024-09-30T14:43:21.783Z https://posit-dev.github.io/great-tables/reference/GT.opt_stylize.html - 2024-09-30T14:41:42.474Z + 2024-09-30T14:43:21.993Z https://posit-dev.github.io/great-tables/reference/data.photolysis.html - 2024-09-30T14:41:42.630Z + 2024-09-30T14:43:22.143Z https://posit-dev.github.io/great-tables/reference/GT.opt_table_outline.html - 2024-09-30T14:41:42.459Z + 2024-09-30T14:43:21.977Z https://posit-dev.github.io/great-tables/reference/GT.fmt_percent.html - 2024-09-30T14:41:42.118Z + 2024-09-30T14:43:21.650Z https://posit-dev.github.io/great-tables/reference/vals.fmt_integer.html - 2024-09-30T14:41:42.518Z + 2024-09-30T14:43:22.037Z https://posit-dev.github.io/great-tables/reference/GT.tab_stub.html - 2024-09-30T14:41:41.950Z + 2024-09-30T14:43:21.486Z https://posit-dev.github.io/great-tables/reference/GT.data_color.html - 2024-09-30T14:41:42.269Z + 2024-09-30T14:43:21.795Z https://posit-dev.github.io/great-tables/reference/GT.fmt_bytes.html - 2024-09-30T14:41:42.170Z + 2024-09-30T14:43:21.700Z https://posit-dev.github.io/great-tables/reference/style.text.html - 2024-09-30T14:41:42.351Z + 2024-09-30T14:43:21.873Z https://posit-dev.github.io/great-tables/reference/data.peeps.html - 2024-09-30T14:41:42.614Z + 2024-09-30T14:43:22.129Z https://posit-dev.github.io/great-tables/reference/GT.fmt_datetime.html - 2024-09-30T14:41:42.207Z + 2024-09-30T14:43:21.736Z https://posit-dev.github.io/great-tables/reference/vals.fmt_currency.html - 2024-09-30T14:41:42.560Z + 2024-09-30T14:43:22.078Z https://posit-dev.github.io/great-tables/reference/data.exibble.html - 2024-09-30T14:41:42.610Z + 2024-09-30T14:43:22.125Z https://posit-dev.github.io/great-tables/reference/GT.fmt_integer.html - 2024-09-30T14:41:42.102Z + 2024-09-30T14:43:21.634Z https://posit-dev.github.io/great-tables/reference/data.pizzaplace.html - 2024-09-30T14:41:42.608Z + 2024-09-30T14:43:22.123Z https://posit-dev.github.io/great-tables/reference/data.illness.html - 2024-09-30T14:41:42.625Z + 2024-09-30T14:43:22.139Z https://posit-dev.github.io/great-tables/reference/data.nuclides.html - 2024-09-30T14:41:42.632Z + 2024-09-30T14:43:22.145Z https://posit-dev.github.io/great-tables/reference/GT.cols_move.html - 2024-09-30T14:41:42.308Z + 2024-09-30T14:43:21.832Z https://posit-dev.github.io/great-tables/reference/GT.fmt_date.html - 2024-09-30T14:41:42.188Z + 2024-09-30T14:43:21.718Z https://posit-dev.github.io/great-tables/reference/index.html - 2024-09-30T14:41:41.442Z + 2024-09-30T14:43:20.988Z https://posit-dev.github.io/great-tables/reference/GT.opt_row_striping.html - 2024-09-30T14:41:42.436Z + 2024-09-30T14:43:21.955Z https://posit-dev.github.io/great-tables/reference/GT.tab_stubhead.html - 2024-09-30T14:41:41.956Z + 2024-09-30T14:43:21.491Z https://posit-dev.github.io/great-tables/reference/vals.fmt_percent.html - 2024-09-30T14:41:42.545Z + 2024-09-30T14:43:22.063Z https://posit-dev.github.io/great-tables/reference/vals.fmt_date.html - 2024-09-30T14:41:42.586Z + 2024-09-30T14:43:22.102Z https://posit-dev.github.io/great-tables/reference/vals.fmt_number.html - 2024-09-30T14:41:42.509Z + 2024-09-30T14:43:22.027Z https://posit-dev.github.io/great-tables/articles/intro.html - 2024-09-30T14:40:35.231Z + 2024-09-30T14:41:06.760Z https://posit-dev.github.io/great-tables/reference/GT.opt_align_table_header.html - 2024-09-30T14:41:42.431Z + 2024-09-30T14:43:21.950Z https://posit-dev.github.io/great-tables/reference/GT.fmt_scientific.html - 2024-09-30T14:41:42.135Z + 2024-09-30T14:43:21.667Z https://posit-dev.github.io/great-tables/reference/data.sp500.html - 2024-09-30T14:41:42.606Z + 2024-09-30T14:43:22.121Z https://posit-dev.github.io/great-tables/reference/GT.fmt_markdown.html - 2024-09-30T14:41:42.213Z + 2024-09-30T14:43:21.742Z https://posit-dev.github.io/great-tables/reference/GT.fmt_image.html - 2024-09-30T14:41:42.232Z + 2024-09-30T14:43:21.760Z https://posit-dev.github.io/great-tables/reference/GT.tab_header.html - 2024-09-30T14:41:41.935Z + 2024-09-30T14:43:21.471Z https://posit-dev.github.io/great-tables/reference/vals.fmt_scientific.html - 2024-09-30T14:41:42.532Z + 2024-09-30T14:43:22.050Z https://posit-dev.github.io/great-tables/reference/GT.fmt_currency.html - 2024-09-30T14:41:42.153Z + 2024-09-30T14:43:21.685Z https://posit-dev.github.io/great-tables/reference/GT.cols_align.html - 2024-09-30T14:41:42.289Z + 2024-09-30T14:43:21.814Z https://posit-dev.github.io/great-tables/reference/GT.fmt_roman.html - 2024-09-30T14:41:42.178Z + 2024-09-30T14:43:21.708Z https://posit-dev.github.io/great-tables/reference/GT.opt_table_font.html - 2024-09-30T14:41:42.468Z + 2024-09-30T14:43:21.987Z https://posit-dev.github.io/great-tables/reference/data.gibraltar.html - 2024-09-30T14:41:42.621Z + 2024-09-30T14:43:22.135Z https://posit-dev.github.io/great-tables/reference/vals.fmt_bytes.html - 2024-09-30T14:41:42.579Z + 2024-09-30T14:43:22.095Z https://posit-dev.github.io/great-tables/reference/data.constants.html - 2024-09-30T14:41:42.623Z + 2024-09-30T14:43:22.137Z https://posit-dev.github.io/great-tables/reference/GT.with_id.html - 2024-09-30T14:41:42.365Z + 2024-09-30T14:43:21.886Z https://posit-dev.github.io/great-tables/reference/data.countrypops.html - 2024-09-30T14:41:42.599Z + 2024-09-30T14:43:22.115Z https://posit-dev.github.io/great-tables/reference/GT.opt_vertical_padding.html - 2024-09-30T14:41:42.447Z + 2024-09-30T14:43:21.966Z https://posit-dev.github.io/great-tables/reference/system_fonts.html - 2024-09-30T14:41:42.389Z + 2024-09-30T14:43:21.910Z https://posit-dev.github.io/great-tables/reference/loc.body.html - 2024-09-30T14:41:42.329Z + 2024-09-30T14:43:21.852Z https://posit-dev.github.io/great-tables/reference/GT.fmt_number.html - 2024-09-30T14:41:42.089Z + 2024-09-30T14:43:21.622Z https://posit-dev.github.io/great-tables/reference/GT.fmt_time.html - 2024-09-30T14:41:42.198Z + 2024-09-30T14:43:21.727Z https://posit-dev.github.io/great-tables/reference/data.towny.html - 2024-09-30T14:41:42.612Z + 2024-09-30T14:43:22.127Z https://posit-dev.github.io/great-tables/reference/GT.show.html - 2024-09-30T14:41:42.490Z + 2024-09-30T14:43:22.009Z https://posit-dev.github.io/great-tables/reference/GT.cols_move_to_start.html - 2024-09-30T14:41:42.313Z + 2024-09-30T14:43:21.837Z https://posit-dev.github.io/great-tables/reference/nanoplot_options.html - 2024-09-30T14:41:42.426Z + 2024-09-30T14:43:21.945Z https://posit-dev.github.io/great-tables/reference/vals.fmt_roman.html - 2024-09-30T14:41:42.566Z + 2024-09-30T14:43:22.083Z https://posit-dev.github.io/great-tables/reference/GT.tab_source_note.html - 2024-09-30T14:41:41.961Z + 2024-09-30T14:43:21.497Z https://posit-dev.github.io/great-tables/reference/GT.save.html - 2024-09-30T14:41:42.485Z + 2024-09-30T14:43:22.004Z https://posit-dev.github.io/great-tables/reference/GT.cols_move_to_end.html - 2024-09-30T14:41:42.318Z + 2024-09-30T14:43:21.841Z https://posit-dev.github.io/great-tables/reference/GT.cols_hide.html - 2024-09-30T14:41:42.324Z + 2024-09-30T14:43:21.847Z https://posit-dev.github.io/great-tables/reference/style.fill.html - 2024-09-30T14:41:42.334Z + 2024-09-30T14:43:21.857Z https://posit-dev.github.io/great-tables/reference/GT.with_locale.html - 2024-09-30T14:41:42.367Z + 2024-09-30T14:43:21.889Z https://posit-dev.github.io/great-tables/reference/data.gtcars.html - 2024-09-30T14:41:42.603Z + 2024-09-30T14:43:22.119Z https://posit-dev.github.io/great-tables/reference/style.borders.html - 2024-09-30T14:41:42.362Z + 2024-09-30T14:43:21.883Z https://posit-dev.github.io/great-tables/reference/md.html - 2024-09-30T14:41:42.371Z + 2024-09-30T14:43:21.893Z https://posit-dev.github.io/great-tables/reference/GT.opt_horizontal_padding.html - 2024-09-30T14:41:42.452Z + 2024-09-30T14:43:21.971Z https://posit-dev.github.io/great-tables/reference/data.films.html - 2024-09-30T14:41:42.617Z + 2024-09-30T14:43:22.131Z https://posit-dev.github.io/great-tables/reference/html.html - 2024-09-30T14:41:42.375Z + 2024-09-30T14:43:21.897Z https://posit-dev.github.io/great-tables/reference/GT.sub_missing.html - 2024-09-30T14:41:42.276Z + 2024-09-30T14:43:21.801Z https://posit-dev.github.io/great-tables/reference/GT.fmt_units.html - 2024-09-30T14:41:42.221Z + 2024-09-30T14:43:21.750Z https://posit-dev.github.io/great-tables/reference/GT.opt_all_caps.html - 2024-09-30T14:41:42.442Z + 2024-09-30T14:43:21.961Z https://posit-dev.github.io/great-tables/reference/from_column.html - 2024-09-30T14:41:42.379Z + 2024-09-30T14:43:21.900Z https://posit-dev.github.io/great-tables/get-started/index.html - 2024-09-30T14:40:35.280Z + 2024-09-30T14:41:06.808Z https://posit-dev.github.io/great-tables/get-started/basic-header.html - 2024-09-30T14:40:35.280Z + 2024-09-30T14:41:06.807Z https://posit-dev.github.io/great-tables/get-started/overview.html - 2024-09-30T14:40:35.280Z + 2024-09-30T14:41:06.808Z https://posit-dev.github.io/great-tables/get-started/table-theme-premade.html - 2024-09-30T14:40:35.281Z + 2024-09-30T14:41:06.808Z https://posit-dev.github.io/great-tables/get-started/nanoplots.html - 2024-09-30T14:40:35.280Z + 2024-09-30T14:41:06.808Z https://posit-dev.github.io/great-tables/get-started/column-selection.html - 2024-09-30T14:40:35.280Z + 2024-09-30T14:41:06.808Z https://posit-dev.github.io/great-tables/get-started/colorizing-with-data.html - 2024-09-30T14:40:35.280Z + 2024-09-30T14:41:06.807Z https://posit-dev.github.io/great-tables/blog/bring-your-own-df/index.html - 2024-09-30T14:40:35.241Z + 2024-09-30T14:41:06.770Z https://posit-dev.github.io/great-tables/blog/design-philosophy/index.html - 2024-09-30T14:40:35.250Z + 2024-09-30T14:41:06.778Z https://posit-dev.github.io/great-tables/blog/introduction-0.4.0/index.html - 2024-09-30T14:40:35.270Z + 2024-09-30T14:41:06.798Z https://posit-dev.github.io/great-tables/blog/polars-styling/index.html - 2024-09-30T14:40:35.270Z + 2024-09-30T14:41:06.798Z https://posit-dev.github.io/great-tables/blog/superbowl-squares/index.html - 2024-09-30T14:40:35.278Z + 2024-09-30T14:41:06.806Z