diff --git a/examples-qmd/fmt-number.html b/examples-qmd/fmt-number.html index 1297dc5e7..8e70c71e9 100644 --- a/examples-qmd/fmt-number.html +++ b/examples-qmd/fmt-number.html @@ -697,7 +697,7 @@ 2 1154638713 1240613620 1322866505 1396387127 4 295516599 309327143 320738994 331511512 1 228805144 244016173 259091970 271857970 -3 174372098 194454498 210969298 227196741 , _body=<great_tables._gt_data.Body object at 0x7fa4bd747c10>, _boxhead=Boxhead([<great_tables._gt_data.ColInfo object at 0x7fa4bd79f310>, <great_tables._gt_data.ColInfo object at 0x7fa4bd79f370>, <great_tables._gt_data.ColInfo object at 0x7fa4bd79f6d0>, <great_tables._gt_data.ColInfo object at 0x7fa4bd79e860>, <great_tables._gt_data.ColInfo object at 0x7fa4bd79ece0>, <great_tables._gt_data.ColInfo object at 0x7fa4bd79f280>, <great_tables._gt_data.ColInfo object at 0x7fa4bd79f3d0>, <great_tables._gt_data.ColInfo object at 0x7fa4bd79f1c0>, <great_tables._gt_data.ColInfo object at 0x7fa4bd79fca0>, <great_tables._gt_data.ColInfo object at 0x7fa4bd79e950>]), _stub=Stub([RowInfo(rownum_i=0, group_id=None, rowname=None, group_label=None, built=False), RowInfo(rownum_i=1, group_id=None, rowname=None, group_label=None, built=False), RowInfo(rownum_i=2, group_id=None, rowname=None, group_label=None, built=False), RowInfo(rownum_i=3, group_id=None, rowname=None, group_label=None, built=False), RowInfo(rownum_i=4, group_id=None, rowname=None, group_label=None, built=False)]), _row_groups=RowGroups([]), _spanners=<great_tables._gt_data.Spanners object at 0x7fa4bd79f100>, _heading=<great_tables._gt_data.Heading object at 0x7fa4bd79e830>, _stubhead=<great_tables._gt_data.Stubhead object at 0x7fa4bd79f130>, _source_notes=<great_tables._gt_data.SourceNotes object at 0x7fa4bd79eec0>, _footnotes=<great_tables._gt_data.Footnotes object at 0x7fa4bd79ed40>, _styles=<great_tables._gt_data.Styles object at 0x7fa4bd79fc70>, _locale=<great_tables._gt_data.Locale object at 0x7fa4bd79fd00>, _formats=[<great_tables._gt_data.FormatInfo object at 0x7fa4bd5e0100>, <great_tables._gt_data.FormatInfo object at 0x7fa4bd5e0250>], _options=<great_tables._gt_data.Options object at 0x7fa4bd79fb80>, _has_built=False) +3 174372098 194454498 210969298 227196741 , _body=<great_tables._gt_data.Body object at 0x7f346443fc10>, _boxhead=Boxhead([<great_tables._gt_data.ColInfo object at 0x7f346449b310>, <great_tables._gt_data.ColInfo object at 0x7f346449b370>, <great_tables._gt_data.ColInfo object at 0x7f346449b6d0>, <great_tables._gt_data.ColInfo object at 0x7f346449a860>, <great_tables._gt_data.ColInfo object at 0x7f346449ace0>, <great_tables._gt_data.ColInfo object at 0x7f346449a8f0>, <great_tables._gt_data.ColInfo object at 0x7f346449b3d0>, <great_tables._gt_data.ColInfo object at 0x7f346449b1c0>, <great_tables._gt_data.ColInfo object at 0x7f346449bca0>, <great_tables._gt_data.ColInfo object at 0x7f346449a950>]), _stub=Stub([RowInfo(rownum_i=0, group_id=None, rowname=None, group_label=None, built=False), RowInfo(rownum_i=1, group_id=None, rowname=None, group_label=None, built=False), RowInfo(rownum_i=2, group_id=None, rowname=None, group_label=None, built=False), RowInfo(rownum_i=3, group_id=None, rowname=None, group_label=None, built=False), RowInfo(rownum_i=4, group_id=None, rowname=None, group_label=None, built=False)]), _row_groups=RowGroups([]), _spanners=<great_tables._gt_data.Spanners object at 0x7f346449b100>, _heading=<great_tables._gt_data.Heading object at 0x7f346449a830>, _stubhead=<great_tables._gt_data.Stubhead object at 0x7f346449b130>, _source_notes=<great_tables._gt_data.SourceNotes object at 0x7f346449aec0>, _footnotes=<great_tables._gt_data.Footnotes object at 0x7f346449ad40>, _styles=<great_tables._gt_data.Styles object at 0x7f346449bc70>, _locale=<great_tables._gt_data.Locale object at 0x7f346449bd00>, _formats=[<great_tables._gt_data.FormatInfo object at 0x7f34642e4100>, <great_tables._gt_data.FormatInfo object at 0x7f34642e4250>], _options=<great_tables._gt_data.Options object at 0x7f346449bb80>, _has_built=False)

In a variation of the previous table, we can combine large-number suffixing with a declaration of the number of significant digits to use. With things like population figures, n_sigfig=3 is a very good option.

diff --git a/examples-qmd/table-manipulation.html b/examples-qmd/table-manipulation.html index a5f22c151..a80448179 100644 --- a/examples-qmd/table-manipulation.html +++ b/examples-qmd/table-manipulation.html @@ -188,7 +188,7 @@ 1 Ferrari 458 Speciale 291744 2 Ferrari 458 Spider 263553 3 Ferrari 458 Italia 233509 -4 Ferrari 488 GTB 245400, _body=<great_tables._gt_data.Body object at 0x7f0201649180>, _boxhead=Boxhead([<great_tables._gt_data.ColInfo object at 0x7f0201648640>, <great_tables._gt_data.ColInfo object at 0x7f0201648c70>, <great_tables._gt_data.ColInfo object at 0x7f02016489d0>]), _stub=Stub([RowInfo(rownum_i=0, group_id=None, rowname=None, group_label=None, built=False), RowInfo(rownum_i=1, group_id=None, rowname=None, group_label=None, built=False), RowInfo(rownum_i=2, group_id=None, rowname=None, group_label=None, built=False), RowInfo(rownum_i=3, group_id=None, rowname=None, group_label=None, built=False), RowInfo(rownum_i=4, group_id=None, rowname=None, group_label=None, built=False)]), _row_groups=RowGroups([]), _spanners=<great_tables._gt_data.Spanners object at 0x7f02016491e0>, _heading=<great_tables._gt_data.Heading object at 0x7f0201649330>, _stubhead=<great_tables._gt_data.Stubhead object at 0x7f02016484f0>, _source_notes=<great_tables._gt_data.SourceNotes object at 0x7f02016491b0>, _footnotes=<great_tables._gt_data.Footnotes object at 0x7f0201649450>, _styles=<great_tables._gt_data.Styles object at 0x7f0201649690>, _locale=<great_tables._gt_data.Locale object at 0x7f02016496c0>, _formats=[<great_tables._gt_data.FormatInfo object at 0x7f0201661570>], _options=<great_tables._gt_data.Options object at 0x7f0201649660>, _has_built=False) +4 Ferrari 488 GTB 245400, _body=<great_tables._gt_data.Body object at 0x7f124e62d090>, _boxhead=Boxhead([<great_tables._gt_data.ColInfo object at 0x7f124e62c520>, <great_tables._gt_data.ColInfo object at 0x7f124e62ca90>, <great_tables._gt_data.ColInfo object at 0x7f124e62c250>]), _stub=Stub([RowInfo(rownum_i=0, group_id=None, rowname=None, group_label=None, built=False), RowInfo(rownum_i=1, group_id=None, rowname=None, group_label=None, built=False), RowInfo(rownum_i=2, group_id=None, rowname=None, group_label=None, built=False), RowInfo(rownum_i=3, group_id=None, rowname=None, group_label=None, built=False), RowInfo(rownum_i=4, group_id=None, rowname=None, group_label=None, built=False)]), _row_groups=RowGroups([]), _spanners=<great_tables._gt_data.Spanners object at 0x7f124e62d0f0>, _heading=<great_tables._gt_data.Heading object at 0x7f124e62d240>, _stubhead=<great_tables._gt_data.Stubhead object at 0x7f124e62c3d0>, _source_notes=<great_tables._gt_data.SourceNotes object at 0x7f124e62d0c0>, _footnotes=<great_tables._gt_data.Footnotes object at 0x7f124e62d360>, _styles=<great_tables._gt_data.Styles object at 0x7f124e62d5a0>, _locale=<great_tables._gt_data.Locale object at 0x7f124e62d5d0>, _formats=[<great_tables._gt_data.FormatInfo object at 0x7f124e645480>], _options=<great_tables._gt_data.Options object at 0x7f124e62d570>, _has_built=False)
diff --git a/index.html b/index.html index ce731148e..c565983ca 100644 --- a/index.html +++ b/index.html @@ -1,7 +1,7 @@ - Redirect to examples-qmd/table-manipulation.html - + Redirect to articles/case-study-gtcars.html + diff --git a/search.json b/search.json index 53d3dbfa2..b92a2ae7d 100644 --- a/search.json +++ b/search.json @@ -1,73 +1,52 @@ [ { - "objectID": "reference/GT.fmt.html", - "href": "reference/GT.fmt.html", - "title": "GT.fmt", - "section": "", - "text": "GT.fmt(x, fns, columns=None, rows=None)\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\n\n\n\n\n\n\n\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\nfns\nUnion[FormatFn, FormatFns]\nEither a single formatting function or a named list of functions.\nrequired\n\n\ncolumns\nUnion[str, List[str], 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\nUnion[int, 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\n\n\n\n\n\n\n\nType\nDescription\n\n\n\n\nGTData\nThe GTData object is returned." - }, - { - "objectID": "reference/GT.fmt.html#parameters", - "href": "reference/GT.fmt.html#parameters", - "title": "GT.fmt", - "section": "", - "text": "Name\nType\nDescription\nDefault\n\n\n\n\nfns\nUnion[FormatFn, FormatFns]\nEither a single formatting function or a named list of functions.\nrequired\n\n\ncolumns\nUnion[str, List[str], 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\nUnion[int, 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" - }, - { - "objectID": "reference/GT.fmt.html#returns", - "href": "reference/GT.fmt.html#returns", - "title": "GT.fmt", - "section": "", - "text": "Type\nDescription\n\n\n\n\nGTData\nThe GTData object is returned." - }, - { - "objectID": "reference/GT.fmt_percent.html", - "href": "reference/GT.fmt_percent.html", - "title": "GT.fmt_percent", + "objectID": "examples-qmd/GT.html", + "href": "examples-qmd/GT.html", + "title": "great_tables", "section": "", - "text": "GT.fmt_percent\nGT.fmt_percent(columns=None, rows=None, decimals=2, drop_trailing_zeros=False, drop_trailing_dec_mark=True)" + "text": "import great_tables as gt\nfrom great_tables import exibble\n\nLet’s use the exibble dataset for the next few examples, we’ll learn how to make simple gt tables with the GT() class. The most basic thing to do is to just use GT() with the dataset as the input.\n\ngt.GT(exibble)\n\n\n\n\n\n\n\n\nnum\nchar\nfctr\ndate\ntime\ndatetime\ncurrency\nrow\ngroup\n\n\n\n\n0.1111\napricot\none\n2015-01-15\n13:35\n2018-01-01 02:22\n49.95\nrow_1\ngrp_a\n\n\n2.222\nbanana\ntwo\n2015-02-15\n14:40\n2018-02-02 14:33\n17.95\nrow_2\ngrp_a\n\n\n33.33\ncoconut\nthree\n2015-03-15\n15:45\n2018-03-03 03:44\n1.39\nrow_3\ngrp_a\n\n\n444.4\ndurian\nfour\n2015-04-15\n16:50\n2018-04-04 15:55\n65100.0\nrow_4\ngrp_a\n\n\n5550.0\nnan\nfive\n2015-05-15\n17:55\n2018-05-05 04:00\n1325.81\nrow_5\ngrp_b\n\n\nnan\nfig\nsix\n2015-06-15\nnan\n2018-06-06 16:11\n13.255\nrow_6\ngrp_b\n\n\n777000.0\ngrapefruit\nseven\nnan\n19:10\n2018-07-07 05:22\nnan\nrow_7\ngrp_b\n\n\n8880000.0\nhoneydew\neight\n2015-08-15\n20:20\nnan\n0.44\nrow_8\ngrp_b\n\n\n\n\n\n\n \n\n\nThis 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 name of the column to use.\n\ngt.GT(exibble, rowname_col=\"row\")\n\nThis 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.\nThe group column can be used to divide the rows into discrete groups. Within that column, we see repetitions of the values 'grp_a' and 'grp_b'. These serve both as ID values and the initial label for the groups. With the groupname_col argument in GT(), we can set up the row groups immediately upon creation of the table.\n\ngt.GT(exibble, rowname_col=\"row\", groupname_col=\"group\")\n\nIf you’d rather perform the set up of row groups later (i.e., not in the GT() call), this is possible with use of the tab_row_group() method (and row_group_order() can help with the arrangement of row groups).\nOne more thing to consider with row groups is their layout. By default, row group labels reside in separate rows the appear above the group. However, we can use the row_group_as_column=True option to put the row group labels within a secondary column within the table stub.\n\ngt.GT(exibble, rowname_col=\"row\", groupname_col=\"group\", row_group_as_column=True)\n\nThis could be done later if need be, and using tab_options(row_group.as_column=True) would be the way to do it outside of the GT() call.\nSome datasets have rownames built in; mtcars has the car model names as the rownames. To use those rownames as row labels in the stub, the rownames_to_stub=TRUE option will prove to be useful.\n\ngt.GT(head(mtcars, 10), rownames_to_stub=True)\n\nBy default, values in the body of a gt 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.\n\ngt.GT(exibble, rowname_col=\"row\", auto_align=False)\n\nWhat 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.\nHowever which way you generate the initial gt table object, you can use it with a huge variety of methods in the package 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 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() and using formatting methods:\n\ngt.GT(\n exibble, rowname_col=\"row\", groupname_col=\"group\", locale=\"fr\"\n).fmt_number().fmt_date(columns=\"date\", date_style=\"yMEd\").fmt_datetime(\n columns=\"datetime\", format=\"EEEE, MMMM d, y\", locale=\"en\"\n)" }, { - "objectID": "reference/GT.opt_all_caps.html", - "href": "reference/GT.opt_all_caps.html", - "title": "GT.opt_all_caps", + "objectID": "examples-qmd/fmt-number.html", + "href": "examples-qmd/fmt-number.html", + "title": "great_tables", "section": "", - "text": "GT.opt_all_caps(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 function serves as a convenient shortcut for tab_options(<location>.text_transform=\"uppercase\", <location>.font.size=gt.pct(80), <location>.font.weight=\"bolder\") (for all locations selected).\n\n\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\nUnion[str, 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\n\n\n\n\nType\nDescription\n\n\n\n\nGT\nResult of the table operation." + "text": "import great_tables as gt\nfrom great_tables import exibble, countrypops\n\nUse the exibble dataset to create a gt 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\ngt.GT(exibble).fmt_number(columns='num', decimals=3).cols_label(char = \"character\")\n\n/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/great_tables/_tbl_data.py:142: SettingWithCopyWarning: \nA value is trying to be set on a copy of a slice from a DataFrame\n\nSee the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n data[column][row] = value\n\n\n\n\n\n\n\n\n\nnum\ncharacter\nfctr\ndate\ntime\ndatetime\ncurrency\nrow\ngroup\n\n\n\n\n0.111\napricot\none\n2015-01-15\n13:35\n2018-01-01 02:22\n49.95\nrow_1\ngrp_a\n\n\n2.222\nbanana\ntwo\n2015-02-15\n14:40\n2018-02-02 14:33\n17.95\nrow_2\ngrp_a\n\n\n33.330\ncoconut\nthree\n2015-03-15\n15:45\n2018-03-03 03:44\n1.39\nrow_3\ngrp_a\n\n\n444.400\ndurian\nfour\n2015-04-15\n16:50\n2018-04-04 15:55\n65100.0\nrow_4\ngrp_a\n\n\n5,550.000\nnan\nfive\n2015-05-15\n17:55\n2018-05-05 04:00\n1325.81\nrow_5\ngrp_b\n\n\nnan\nfig\nsix\n2015-06-15\nnan\n2018-06-06 16:11\n13.255\nrow_6\ngrp_b\n\n\n777,000.000\ngrapefruit\nseven\nnan\n19:10\n2018-07-07 05:22\nnan\nrow_7\ngrp_b\n\n\n8,880,000.000\nhoneydew\neight\n2015-08-15\n20:20\nnan\n0.44\nrow_8\ngrp_b\n\n\n\n\n\n\n \n\n\nUse a modified version of the countrypops dataset to create a gt table with row labels. Format all columns to use large-number suffixing (e.g., where '10,000,000' becomes '10M') with the suffixing=True option.\n\nfrom siuba import *\nres = (countrypops\n >> select(_.country_code_3, _.year, _.population)\n >> filter(_.country_code_3.isin(['CHN', 'IND', 'USA', 'PAK', 'IDN']))\n >> filter(_.year > 1975, _.year % 5 == 0)\n >> spread(_.year, _.population)\n >> arrange(-_[2015])\n)\n\n# TODO: implement `suffixing`\n(gt.GT(res)\n .fmt_integer(columns=1980, scale_by=1/10000)\n .fmt_number(columns=1985)\n)\n\nTypeError: Invalid value '98124' for dtype Int64\n\n\nGT(_tbl_data= country_code_3 1980 1985 1990 1995 2000 \\\n0 CHN 981235000 1051040000 1135185000 1204855000 1262645000 \n2 IND 696828385 780242084 870452165 964279129 1059633675 \n4 USA 227225000 237924000 249623000 266278000 282162411 \n1 IDN 148177096 165791694 182159874 198140162 214072421 \n3 PAK 80624057 97121552 115414069 133117476 154369924 \n\n 2005 2010 2015 2020 \n0 1303720000 1337705000 1379860000 1411100000 \n2 1154638713 1240613620 1322866505 1396387127 \n4 295516599 309327143 320738994 331511512 \n1 228805144 244016173 259091970 271857970 \n3 174372098 194454498 210969298 227196741 , _body=<great_tables._gt_data.Body object at 0x7f346443fc10>, _boxhead=Boxhead([<great_tables._gt_data.ColInfo object at 0x7f346449b310>, <great_tables._gt_data.ColInfo object at 0x7f346449b370>, <great_tables._gt_data.ColInfo object at 0x7f346449b6d0>, <great_tables._gt_data.ColInfo object at 0x7f346449a860>, <great_tables._gt_data.ColInfo object at 0x7f346449ace0>, <great_tables._gt_data.ColInfo object at 0x7f346449a8f0>, <great_tables._gt_data.ColInfo object at 0x7f346449b3d0>, <great_tables._gt_data.ColInfo object at 0x7f346449b1c0>, <great_tables._gt_data.ColInfo object at 0x7f346449bca0>, <great_tables._gt_data.ColInfo object at 0x7f346449a950>]), _stub=Stub([RowInfo(rownum_i=0, group_id=None, rowname=None, group_label=None, built=False), RowInfo(rownum_i=1, group_id=None, rowname=None, group_label=None, built=False), RowInfo(rownum_i=2, group_id=None, rowname=None, group_label=None, built=False), RowInfo(rownum_i=3, group_id=None, rowname=None, group_label=None, built=False), RowInfo(rownum_i=4, group_id=None, rowname=None, group_label=None, built=False)]), _row_groups=RowGroups([]), _spanners=<great_tables._gt_data.Spanners object at 0x7f346449b100>, _heading=<great_tables._gt_data.Heading object at 0x7f346449a830>, _stubhead=<great_tables._gt_data.Stubhead object at 0x7f346449b130>, _source_notes=<great_tables._gt_data.SourceNotes object at 0x7f346449aec0>, _footnotes=<great_tables._gt_data.Footnotes object at 0x7f346449ad40>, _styles=<great_tables._gt_data.Styles object at 0x7f346449bc70>, _locale=<great_tables._gt_data.Locale object at 0x7f346449bd00>, _formats=[<great_tables._gt_data.FormatInfo object at 0x7f34642e4100>, <great_tables._gt_data.FormatInfo object at 0x7f34642e4250>], _options=<great_tables._gt_data.Options object at 0x7f346449bb80>, _has_built=False)\n\n\nIn a variation of the previous table, we can combine large-number suffixing with a declaration of the number of significant digits to use. With things like population figures, n_sigfig=3 is a very good option.\n\n#countrypops |>\n# dplyr::select(country_code_3, year, population) |>\n# dplyr::filter(country_code_3 %in% c('CHN', 'IND', 'USA', 'PAK', 'IDN')) |>\n# dplyr::filter(year > 1975 & year %% 5 == 0) |>\n# tidyr::spread(year, population) |>\n# dplyr::arrange(desc(`2015`)) |>\n# gt(rowname_col='country_code_3') |>\n# fmt_number(suffixing=True, n_sigfig=3)\n\nThere can be cases where you want to show numbers to a large number of decimal places but also drop the unnecessary trailing zeros for low-precision values. Let’s take a portion of the towny dataset and format the latitude and longitude columns with fmt_number(). We’ll have up to 5 digits displayed as decimal values, but we’ll also unconditionally drop any runs of trailing zeros in the decimal part with drop_trailing_zeros=True.\n\ntowny |>\n dplyr::select(name, latitude, longitude) |>\n dplyr::slice_head(n=10) |>\n gt() |>\n fmt_number(decimals=5, drop_trailing_zeros=True) |>\n # replace -name with [latitude, longitude]\n ## cols_merge(columns=-name, pattern='{1}, {2}') |>\n cols_label(\n name~'Municipality',\n latitude='Location'\n )" }, { - "objectID": "reference/GT.opt_all_caps.html#parameters", - "href": "reference/GT.opt_all_caps.html#parameters", - "title": "GT.opt_all_caps", + "objectID": "changelog.html", + "href": "changelog.html", + "title": "Changelog", "section": "", - "text": "Name\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\nUnion[str, 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']" + "text": "I am the changelog" }, { - "objectID": "reference/GT.opt_all_caps.html#returns", - "href": "reference/GT.opt_all_caps.html#returns", - "title": "GT.opt_all_caps", + "objectID": "reference/GT.html", + "href": "reference/GT.html", + "title": "GT", "section": "", - "text": "Type\nDescription\n\n\n\n\nGT\nResult of the table operation." + "text": "GT(self, data, locale='', **kwargs)\nCreate a gt Table object.\n\n\nrender: Renders and returns the HTML table.\n\n\n\n>>> from gt import *\n>>> x = GT([{\"a\": 5, \"b\": 10}, {\"a\": 15, \"b\": 20}])\n>>> x\n>>> print(x)\n\n\n\n\n\n\nName\nDescription\n\n\n\n\nfmt_integer\nFormat values as integers.\n\n\nfmt_number\nFormat numeric values." }, { - "objectID": "reference/GT.tab_options.html", - "href": "reference/GT.tab_options.html", - "title": "GT.tab_options", + "objectID": "reference/GT.html#methods", + "href": "reference/GT.html#methods", + "title": "GT", "section": "", - "text": "GT.tab_options(container_width=None, container_height=None, container_overflow_x=None, container_overflow_y=None, table_width=None, table_layout=None, table_align=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_right_style=None, table_border_right_width=None, table_border_right_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, 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_default_label=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, summary_row_background_color=None, summary_row_text_transform=None, summary_row_padding=None, summary_row_padding_horizontal=None, summary_row_border_style=None, summary_row_border_width=None, summary_row_border_color=None, grand_summary_row_background_color=None, grand_summary_row_text_transform=None, grand_summary_row_padding=None, grand_summary_row_padding_horizontal=None, grand_summary_row_border_style=None, grand_summary_row_border_width=None, grand_summary_row_border_color=None, footnotes_background_color=None, footnotes_font_size=None, footnotes_padding=None, footnotes_padding_horizontal=None, footnotes_border_bottom_style=None, footnotes_border_bottom_width=None, footnotes_border_bottom_color=None, footnotes_border_lr_style=None, footnotes_border_lr_width=None, footnotes_border_lr_color=None, footnotes_marks=None, footnotes_multiline=None, footnotes_sep=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, page_orientation=None, page_numbering=None, page_header_use_tbl_headings=None, page_footer_use_tbl_notes=None, page_width=None, page_height=None, page_margin_left=None, page_margin_right=None, page_margin_top=None, page_margin_bottom=None, page_header_height=None, page_footer_height=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\n\n\n\n\n\n\n\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\ncontainer_width\nOptional[str]\nThe width and height 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. The px() and pct() helper functions can also be used to pass in numeric values and obtain values as pixel or percent units.\nNone\n\n\ncontainer_overflow_x\nOptional[str]\nOptions to enable scrolling in the horizontal and vertical directions when the table content overflows the container dimensions. Using True (the default for both) means that horizontal or vertical 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 or container_height. table_width The width of the table. 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. The px() and pct() helper functions can also be used to pass in numeric values and obtain values as pixel or percent units. table_layout The value for the table-layout CSS style in the HTML output context. By default, this is \"fixed\" but another valid option is \"auto\". table_align The horizontal alignment of the table in its container. By default, this is \"center\". Other options are \"left\" and \"right\". This will automatically set table_margin_left and table_margin_right to the appropriate values. table_margin_left,table_margin_right The size of the margins on the left and right of the table within the 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. The px() and pct() helper functions can also be used to pass in numeric values and obtain values as pixel or percent units. Using table_margin_left or table_margin_right will overwrite any values set by table_align. table_background_color,heading_background_color,column_labels_background_color,row_group_background_color,stub_background_color,summary_row_background_color,grand_summary_row_background_color,footnotes_background_color,source_notes_background_color Background colors for the parent element table and the following child elements: heading, column_labels, row_group, stub, summary_row, grand_summary_row, footnotes, and source_notes. A color name or a hexadecimal color code should be provided. table_additional_css This option can be used to supply an additional block of CSS rules to be applied after the automatically generated table CSS. table_font_names The 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). table_font_style The font style for the table. Can be one of either \"normal\", \"italic\", or \"oblique\". table_font_color,table_font_color_light The text color used throughout the table. There are two variants: table_font_color is for text overlaid on lighter background colors, and table_font_color_light is automatically used when text needs to be overlaid on darker background colors. A color name or a hexadecimal color code should be provided. table_font_size,heading_title_font_size,heading_subtitle_font_size,column_labels_font_size,row_group_font_size,stub_font_size,footnotes_font_size,source_notes_font_size The font sizes for the parent text element table and the following child elements: heading_title, heading_subtitle, column_labels, row_group, footnotes, and source_notes. Can be specified as a string with units of pixels (e.g., \"12px\") or as a percentage (e.g., \"80%\"). If provided as a scalar numeric value, it is assumed that the value is given in units of pixels. The px() and pct() helper functions can also be used to pass in numeric values and obtain values as pixel or percentage units. heading_align Controls the horizontal alignment of the heading title and subtitle. We can either use \"center\", \"left\", or \"right\". table_font_weight,heading_title_font_weight,heading_subtitle_font_weight,column_labels_font_weight,row_group_font_weight,stub_font_weight The font weights of the table, heading_title, heading_subtitle, column_labels, row_group, and stub text elements. 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. column_labels_text_transform,row_group_text_transform,stub_text_transform,summary_row_text_transform,grand_summary_row_text_transform Options to apply text transformations to the column_labels, row_group, stub, summary_row, and grand_summary_row text elements. Either of the \"uppercase\", \"lowercase\", or \"capitalize\" keywords can be used. heading_padding,column_labels_padding,data_row_padding,row_group_padding,summary_row_padding,grand_summary_row_padding,footnotes_padding,source_notes_padding The amount of vertical padding to incorporate in the heading (title and subtitle), the column_labels (this includes the column spanners), the row group labels (row_group_padding), in the body/stub rows (data_row_padding), in summary rows (summary_row_padding or grand_summary_row_padding), or in the footnotes and source notes (footnotes_padding and source_notes_padding). heading_padding_horizontal,column_labels_padding_horizontal,data_row_padding_horizontal,row_group_padding_horizontal,summary_row_padding_horizontal,grand_summary_row_padding_horizontal,footnotes_padding_horizontal,source_notes_padding_horizontal The amount of horizontal padding to incorporate in the heading (title and subtitle), the column_labels (this includes the column spanners), the row group labels (row_group_padding_horizontal), in the body/stub rows (data_row_padding), in summary rows (summary_row_padding_horizontal or grand_summary_row_padding_horizontal), or in the footnotes and source notes (footnotes_padding_horizontal and source_notes_padding_horizontal). table_border_top_style,table_border_top_width,table_border_top_color,table_border_right_style,table_border_right_width,table_border_right_color,table_border_bottom_style,table_border_bottom_width,table_border_bottom_color,table_border_left_style,table_border_left_width,table_border_left_color The style, width, and color properties of the table’s absolute top and absolute bottom borders. heading_border_bottom_style,heading_border_bottom_width,heading_border_bottom_color The style, width, and color properties of the header’s bottom border. This border shares space with that of the column_labels location. If the width of this border is larger, then it will be the visible border. heading_border_lr_style,heading_border_lr_width,heading_border_lr_color The style, width, and color properties for the left and right borders of the heading location. column_labels_vlines_style,column_labels_vlines_width,column_labels_vlines_color The style, width, and color properties for all vertical lines (‘vlines’) of the the column_labels. column_labels_border_top_style,column_labels_border_top_width,column_labels_border_top_color The style, width, and color properties for the top border of the column_labels location. This border shares space with that of the heading location. If the width of this border is larger, then it will be the visible border. column_labels_border_bottom_style,column_labels_border_bottom_width,column_labels_border_bottom_color The style, width, and color properties for the bottom border of the column_labels location. column_labels_border_lr_style,column_labels_border_lr_width,column_labels_border_lr_color The style, width, and color properties for the left and right borders of the column_labels location. column_labels_hidden An 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. row_group_border_top_style,row_group_border_top_width,row_group_border_top_color,row_group_border_bottom_style,row_group_border_bottom_width,row_group_border_bottom_color,row_group_border_left_style,row_group_border_left_width,row_group_border_left_color,row_group_border_right_style,row_group_border_right_width,row_group_border_right_color The style, width, and color properties for all top, bottom, left, and right borders of the row_group location. table_body_hlines_style,table_body_hlines_width,table_body_hlines_color,table_body_vlines_style,table_body_vlines_width,table_body_vlines_color The style, width, and color properties for all horizontal lines (‘hlines’) and vertical lines (‘vlines’) in the table_body. table_body_border_top_style,table_body_border_top_width,table_body_border_top_color,table_body_border_bottom_style,table_body_border_bottom_width,table_body_border_bottom_color The style, width, and color properties for all top and bottom borders of the table_body location. stub_border_style,stub_border_width,stub_border_color The style, width, and color properties for the vertical border of the table stub. stub_row_group_font_size,stub_row_group_font_weight,stub_row_group_text_transform,stub_row_group_border_style,stub_row_group_border_width,stub_row_group_border_color Options for the row group column in the stub (made possible when using row_group_as_column = TRUE). The defaults for these options mirror that of the stub.* variants (except for stub_row_group_border_width, which is \"1px\" instead of \"2px\"). row_group_default_label An option to set a default row group label for any rows not formally placed in a row group named by group in any call of tab_row_group(). If this is set as None and there are rows that haven’t been placed into a row group (where one or more row groups already exist), those rows will be automatically placed into a row group without a label. row_group_as_column How should row groups be structured? By default, they are separate rows that lie above the each of the groups. Setting this to True will structure row group labels are columns to the far left of the table. summary_row_border_style,summary_row_border_width,summary_row_border_color The style, width, and color properties for all horizontal borders of the summary_row location. grand_summary_row_border_style,grand_summary_row_border_width,grand_summary_row_border_color The style, width, and color properties for the top borders of the grand_summary_row location. footnotes_border_bottom_style,footnotes_border_bottom_width,footnotes_border_bottom_color The style, width, and color properties for the bottom border of the footnotes location. footnotes_border_lr_style,footnotes_border_lr_width,footnotes_border_lr_color The style, width, and color properties for the left and right borders of the footnotes location. footnotes_marks The set of sequential marks used to reference and identify each of the footnotes (same input as the [opt_footnote_marks()] function. We can supply a list that represents the series of footnote marks. This list is recycled when its usage goes beyond the length of the set. At each cycle, the marks are simply combined (e.g., * -> ** -> ***). The option exists for providing keywords for certain types of footnote marks. The keyword \"numbers\" (the default, indicating that we want to use numeric marks). We can use lowercase \"letters\" or uppercase \"LETTERS\". There is the option for using a traditional symbol set where \"standard\" provides four symbols, and, \"extended\" adds two more symbols, making six. footnotes_multiline,source_notes_multiline An option to either put footnotes and source notes in separate lines (the default, or True) or render them as a continuous line of text with footnotes_sep providing the separator (by default \" \") between notes. footnotes_sep,source_notes_sep The separating characters between adjacent footnotes and source notes in their respective footer sections when rendered as a continuous line of text (when footnotes_multiline is False). The default value is a single space character (\" \"). source_notes_border_bottom_style,source_notes_border_bottom_width,source_notes_border_bottom_color The style, width, and color properties for the bottom border of the source_notes location. source_notes_border_lr_style,source_notes_border_lr_width,source_notes_border_lr_color The style, width, and color properties for the left and right borders of the source_notes location. row_striping_background_color The background color for striped table body rows. A color name or a hexadecimal color code should be provided. row_striping_include_stub An option for whether to include the stub when striping rows. row_striping_include_table_body An option for whether to include the table body when striping rows. page_orientation For RTF output, this provides an two options for page orientation: \"portrait\" (the default) and \"landscape\". page_numbering Within RTF output, should page numbering be displayed? By default, this is set to False but if True then page numbering text will be added to the document header. page_header_use_tbl_headings If True then RTF output tables will migrate all table headings (including the table title and all column labels) to the page header. This page header content will repeat across pages. By default, this is False. page_footer_use_tbl_notes If True then RTF output tables will migrate all table footer content (this includes footnotes and source notes) to the page footer. This page footer content will repeat across pages. By default, this is False. page_width,page_height The page width and height in the standard portrait orientation. This is for RTF table output and the default values (in inches) are 8.5in and 11.0in. page_margin_left,page_margin_right,page_margin_top,page_margin_bottom For RTF table output, these options correspond to the left, right, top, and bottom page margins. The default values for each of these is 1.0in. page_header_height,page_footer_height The heights of the page header and footer for RTF table outputs. Default values for both are 0.5in.\nNone\n\n\n\n\n\n\n\n\n\nType\nDescription\n\n\n\n\nGT\nResult of the table operation." + "text": "render: Renders and returns the HTML table." }, { - "objectID": "reference/GT.tab_options.html#parameters", - "href": "reference/GT.tab_options.html#parameters", - "title": "GT.tab_options", + "objectID": "reference/GT.html#examples", + "href": "reference/GT.html#examples", + "title": "GT", "section": "", - "text": "Name\nType\nDescription\nDefault\n\n\n\n\ncontainer_width\nOptional[str]\nThe width and height 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. The px() and pct() helper functions can also be used to pass in numeric values and obtain values as pixel or percent units.\nNone\n\n\ncontainer_overflow_x\nOptional[str]\nOptions to enable scrolling in the horizontal and vertical directions when the table content overflows the container dimensions. Using True (the default for both) means that horizontal or vertical 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 or container_height. table_width The width of the table. 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. The px() and pct() helper functions can also be used to pass in numeric values and obtain values as pixel or percent units. table_layout The value for the table-layout CSS style in the HTML output context. By default, this is \"fixed\" but another valid option is \"auto\". table_align The horizontal alignment of the table in its container. By default, this is \"center\". Other options are \"left\" and \"right\". This will automatically set table_margin_left and table_margin_right to the appropriate values. table_margin_left,table_margin_right The size of the margins on the left and right of the table within the 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. The px() and pct() helper functions can also be used to pass in numeric values and obtain values as pixel or percent units. Using table_margin_left or table_margin_right will overwrite any values set by table_align. table_background_color,heading_background_color,column_labels_background_color,row_group_background_color,stub_background_color,summary_row_background_color,grand_summary_row_background_color,footnotes_background_color,source_notes_background_color Background colors for the parent element table and the following child elements: heading, column_labels, row_group, stub, summary_row, grand_summary_row, footnotes, and source_notes. A color name or a hexadecimal color code should be provided. table_additional_css This option can be used to supply an additional block of CSS rules to be applied after the automatically generated table CSS. table_font_names The 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). table_font_style The font style for the table. Can be one of either \"normal\", \"italic\", or \"oblique\". table_font_color,table_font_color_light The text color used throughout the table. There are two variants: table_font_color is for text overlaid on lighter background colors, and table_font_color_light is automatically used when text needs to be overlaid on darker background colors. A color name or a hexadecimal color code should be provided. table_font_size,heading_title_font_size,heading_subtitle_font_size,column_labels_font_size,row_group_font_size,stub_font_size,footnotes_font_size,source_notes_font_size The font sizes for the parent text element table and the following child elements: heading_title, heading_subtitle, column_labels, row_group, footnotes, and source_notes. Can be specified as a string with units of pixels (e.g., \"12px\") or as a percentage (e.g., \"80%\"). If provided as a scalar numeric value, it is assumed that the value is given in units of pixels. The px() and pct() helper functions can also be used to pass in numeric values and obtain values as pixel or percentage units. heading_align Controls the horizontal alignment of the heading title and subtitle. We can either use \"center\", \"left\", or \"right\". table_font_weight,heading_title_font_weight,heading_subtitle_font_weight,column_labels_font_weight,row_group_font_weight,stub_font_weight The font weights of the table, heading_title, heading_subtitle, column_labels, row_group, and stub text elements. 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. column_labels_text_transform,row_group_text_transform,stub_text_transform,summary_row_text_transform,grand_summary_row_text_transform Options to apply text transformations to the column_labels, row_group, stub, summary_row, and grand_summary_row text elements. Either of the \"uppercase\", \"lowercase\", or \"capitalize\" keywords can be used. heading_padding,column_labels_padding,data_row_padding,row_group_padding,summary_row_padding,grand_summary_row_padding,footnotes_padding,source_notes_padding The amount of vertical padding to incorporate in the heading (title and subtitle), the column_labels (this includes the column spanners), the row group labels (row_group_padding), in the body/stub rows (data_row_padding), in summary rows (summary_row_padding or grand_summary_row_padding), or in the footnotes and source notes (footnotes_padding and source_notes_padding). heading_padding_horizontal,column_labels_padding_horizontal,data_row_padding_horizontal,row_group_padding_horizontal,summary_row_padding_horizontal,grand_summary_row_padding_horizontal,footnotes_padding_horizontal,source_notes_padding_horizontal The amount of horizontal padding to incorporate in the heading (title and subtitle), the column_labels (this includes the column spanners), the row group labels (row_group_padding_horizontal), in the body/stub rows (data_row_padding), in summary rows (summary_row_padding_horizontal or grand_summary_row_padding_horizontal), or in the footnotes and source notes (footnotes_padding_horizontal and source_notes_padding_horizontal). table_border_top_style,table_border_top_width,table_border_top_color,table_border_right_style,table_border_right_width,table_border_right_color,table_border_bottom_style,table_border_bottom_width,table_border_bottom_color,table_border_left_style,table_border_left_width,table_border_left_color The style, width, and color properties of the table’s absolute top and absolute bottom borders. heading_border_bottom_style,heading_border_bottom_width,heading_border_bottom_color The style, width, and color properties of the header’s bottom border. This border shares space with that of the column_labels location. If the width of this border is larger, then it will be the visible border. heading_border_lr_style,heading_border_lr_width,heading_border_lr_color The style, width, and color properties for the left and right borders of the heading location. column_labels_vlines_style,column_labels_vlines_width,column_labels_vlines_color The style, width, and color properties for all vertical lines (‘vlines’) of the the column_labels. column_labels_border_top_style,column_labels_border_top_width,column_labels_border_top_color The style, width, and color properties for the top border of the column_labels location. This border shares space with that of the heading location. If the width of this border is larger, then it will be the visible border. column_labels_border_bottom_style,column_labels_border_bottom_width,column_labels_border_bottom_color The style, width, and color properties for the bottom border of the column_labels location. column_labels_border_lr_style,column_labels_border_lr_width,column_labels_border_lr_color The style, width, and color properties for the left and right borders of the column_labels location. column_labels_hidden An 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. row_group_border_top_style,row_group_border_top_width,row_group_border_top_color,row_group_border_bottom_style,row_group_border_bottom_width,row_group_border_bottom_color,row_group_border_left_style,row_group_border_left_width,row_group_border_left_color,row_group_border_right_style,row_group_border_right_width,row_group_border_right_color The style, width, and color properties for all top, bottom, left, and right borders of the row_group location. table_body_hlines_style,table_body_hlines_width,table_body_hlines_color,table_body_vlines_style,table_body_vlines_width,table_body_vlines_color The style, width, and color properties for all horizontal lines (‘hlines’) and vertical lines (‘vlines’) in the table_body. table_body_border_top_style,table_body_border_top_width,table_body_border_top_color,table_body_border_bottom_style,table_body_border_bottom_width,table_body_border_bottom_color The style, width, and color properties for all top and bottom borders of the table_body location. stub_border_style,stub_border_width,stub_border_color The style, width, and color properties for the vertical border of the table stub. stub_row_group_font_size,stub_row_group_font_weight,stub_row_group_text_transform,stub_row_group_border_style,stub_row_group_border_width,stub_row_group_border_color Options for the row group column in the stub (made possible when using row_group_as_column = TRUE). The defaults for these options mirror that of the stub.* variants (except for stub_row_group_border_width, which is \"1px\" instead of \"2px\"). row_group_default_label An option to set a default row group label for any rows not formally placed in a row group named by group in any call of tab_row_group(). If this is set as None and there are rows that haven’t been placed into a row group (where one or more row groups already exist), those rows will be automatically placed into a row group without a label. row_group_as_column How should row groups be structured? By default, they are separate rows that lie above the each of the groups. Setting this to True will structure row group labels are columns to the far left of the table. summary_row_border_style,summary_row_border_width,summary_row_border_color The style, width, and color properties for all horizontal borders of the summary_row location. grand_summary_row_border_style,grand_summary_row_border_width,grand_summary_row_border_color The style, width, and color properties for the top borders of the grand_summary_row location. footnotes_border_bottom_style,footnotes_border_bottom_width,footnotes_border_bottom_color The style, width, and color properties for the bottom border of the footnotes location. footnotes_border_lr_style,footnotes_border_lr_width,footnotes_border_lr_color The style, width, and color properties for the left and right borders of the footnotes location. footnotes_marks The set of sequential marks used to reference and identify each of the footnotes (same input as the [opt_footnote_marks()] function. We can supply a list that represents the series of footnote marks. This list is recycled when its usage goes beyond the length of the set. At each cycle, the marks are simply combined (e.g., * -> ** -> ***). The option exists for providing keywords for certain types of footnote marks. The keyword \"numbers\" (the default, indicating that we want to use numeric marks). We can use lowercase \"letters\" or uppercase \"LETTERS\". There is the option for using a traditional symbol set where \"standard\" provides four symbols, and, \"extended\" adds two more symbols, making six. footnotes_multiline,source_notes_multiline An option to either put footnotes and source notes in separate lines (the default, or True) or render them as a continuous line of text with footnotes_sep providing the separator (by default \" \") between notes. footnotes_sep,source_notes_sep The separating characters between adjacent footnotes and source notes in their respective footer sections when rendered as a continuous line of text (when footnotes_multiline is False). The default value is a single space character (\" \"). source_notes_border_bottom_style,source_notes_border_bottom_width,source_notes_border_bottom_color The style, width, and color properties for the bottom border of the source_notes location. source_notes_border_lr_style,source_notes_border_lr_width,source_notes_border_lr_color The style, width, and color properties for the left and right borders of the source_notes location. row_striping_background_color The background color for striped table body rows. A color name or a hexadecimal color code should be provided. row_striping_include_stub An option for whether to include the stub when striping rows. row_striping_include_table_body An option for whether to include the table body when striping rows. page_orientation For RTF output, this provides an two options for page orientation: \"portrait\" (the default) and \"landscape\". page_numbering Within RTF output, should page numbering be displayed? By default, this is set to False but if True then page numbering text will be added to the document header. page_header_use_tbl_headings If True then RTF output tables will migrate all table headings (including the table title and all column labels) to the page header. This page header content will repeat across pages. By default, this is False. page_footer_use_tbl_notes If True then RTF output tables will migrate all table footer content (this includes footnotes and source notes) to the page footer. This page footer content will repeat across pages. By default, this is False. page_width,page_height The page width and height in the standard portrait orientation. This is for RTF table output and the default values (in inches) are 8.5in and 11.0in. page_margin_left,page_margin_right,page_margin_top,page_margin_bottom For RTF table output, these options correspond to the left, right, top, and bottom page margins. The default values for each of these is 1.0in. page_header_height,page_footer_height The heights of the page header and footer for RTF table outputs. Default values for both are 0.5in.\nNone" + "text": ">>> from gt import *\n>>> x = GT([{\"a\": 5, \"b\": 10}, {\"a\": 15, \"b\": 20}])\n>>> x\n>>> print(x)" }, { - "objectID": "reference/GT.tab_options.html#returns", - "href": "reference/GT.tab_options.html#returns", - "title": "GT.tab_options", + "objectID": "reference/GT.html#attributes", + "href": "reference/GT.html#attributes", + "title": "GT", "section": "", - "text": "Type\nDescription\n\n\n\n\nGT\nResult of the table operation." + "text": "Name\nDescription\n\n\n\n\nfmt_integer\nFormat values as integers.\n\n\nfmt_number\nFormat numeric values." }, { "objectID": "reference/GT.tab_stubhead.html", @@ -98,46 +77,32 @@ "text": ">>> from gt import *\n>>> x = GT([{\"a\": 5, \"b\": 10}, {\"a\": 15, \"b\": 20}])\n>>> .tab_stubhead(label=\"The Stubhead Label\")\n>>> x\n>>> print(x)" }, { - "objectID": "reference/pct.html", - "href": "reference/pct.html", - "title": "pct", - "section": "", - "text": "pct(x)\nHelper for providing a CSS length value as a percentage.\nA percentage value acts as a length value that is relative to an initial state. For instance an 80% value for something will size the target to 80% the size of its ‘previous’ value. This type of sizing is useful for sizing up or down a length value with an intuitive measure. This helper function can be used for the setting of font sizes (e.g., in cell_text()) and altering the thicknesses of lines (e.g., in cell_borders(). Should a more exact definition of size be required, the analogous helper function pct() will be more useful.\n\n\n\n\n\n\n\n\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\nx\nUnion[int, float]\nThe integer or float value to format as a string-based percentage value for some tab_options() arguments that can take percentage values (e.g., table.width).\nrequired\n\n\n\n\n\n\n>>> from gt import *\n>>> x = gt.pct(80)\n>>> x\n>>> print(x)" - }, - { - "objectID": "reference/pct.html#parameters", - "href": "reference/pct.html#parameters", - "title": "pct", - "section": "", - "text": "Name\nType\nDescription\nDefault\n\n\n\n\nx\nUnion[int, float]\nThe integer or float value to format as a string-based percentage value for some tab_options() arguments that can take percentage values (e.g., table.width).\nrequired" - }, - { - "objectID": "reference/pct.html#examples", - "href": "reference/pct.html#examples", - "title": "pct", + "objectID": "reference/GT.tab_options.html", + "href": "reference/GT.tab_options.html", + "title": "GT.tab_options", "section": "", - "text": ">>> from gt import *\n>>> x = gt.pct(80)\n>>> x\n>>> print(x)" + "text": "GT.tab_options(container_width=None, container_height=None, container_overflow_x=None, container_overflow_y=None, table_width=None, table_layout=None, table_align=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_right_style=None, table_border_right_width=None, table_border_right_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, 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_default_label=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, summary_row_background_color=None, summary_row_text_transform=None, summary_row_padding=None, summary_row_padding_horizontal=None, summary_row_border_style=None, summary_row_border_width=None, summary_row_border_color=None, grand_summary_row_background_color=None, grand_summary_row_text_transform=None, grand_summary_row_padding=None, grand_summary_row_padding_horizontal=None, grand_summary_row_border_style=None, grand_summary_row_border_width=None, grand_summary_row_border_color=None, footnotes_background_color=None, footnotes_font_size=None, footnotes_padding=None, footnotes_padding_horizontal=None, footnotes_border_bottom_style=None, footnotes_border_bottom_width=None, footnotes_border_bottom_color=None, footnotes_border_lr_style=None, footnotes_border_lr_width=None, footnotes_border_lr_color=None, footnotes_marks=None, footnotes_multiline=None, footnotes_sep=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, page_orientation=None, page_numbering=None, page_header_use_tbl_headings=None, page_footer_use_tbl_notes=None, page_width=None, page_height=None, page_margin_left=None, page_margin_right=None, page_margin_top=None, page_margin_bottom=None, page_header_height=None, page_footer_height=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\n\n\n\n\n\n\n\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\ncontainer_width\nOptional[str]\nThe width and height 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. The px() and pct() helper functions can also be used to pass in numeric values and obtain values as pixel or percent units.\nNone\n\n\ncontainer_overflow_x\nOptional[str]\nOptions to enable scrolling in the horizontal and vertical directions when the table content overflows the container dimensions. Using True (the default for both) means that horizontal or vertical 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 or container_height. table_width The width of the table. 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. The px() and pct() helper functions can also be used to pass in numeric values and obtain values as pixel or percent units. table_layout The value for the table-layout CSS style in the HTML output context. By default, this is \"fixed\" but another valid option is \"auto\". table_align The horizontal alignment of the table in its container. By default, this is \"center\". Other options are \"left\" and \"right\". This will automatically set table_margin_left and table_margin_right to the appropriate values. table_margin_left,table_margin_right The size of the margins on the left and right of the table within the 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. The px() and pct() helper functions can also be used to pass in numeric values and obtain values as pixel or percent units. Using table_margin_left or table_margin_right will overwrite any values set by table_align. table_background_color,heading_background_color,column_labels_background_color,row_group_background_color,stub_background_color,summary_row_background_color,grand_summary_row_background_color,footnotes_background_color,source_notes_background_color Background colors for the parent element table and the following child elements: heading, column_labels, row_group, stub, summary_row, grand_summary_row, footnotes, and source_notes. A color name or a hexadecimal color code should be provided. table_additional_css This option can be used to supply an additional block of CSS rules to be applied after the automatically generated table CSS. table_font_names The 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). table_font_style The font style for the table. Can be one of either \"normal\", \"italic\", or \"oblique\". table_font_color,table_font_color_light The text color used throughout the table. There are two variants: table_font_color is for text overlaid on lighter background colors, and table_font_color_light is automatically used when text needs to be overlaid on darker background colors. A color name or a hexadecimal color code should be provided. table_font_size,heading_title_font_size,heading_subtitle_font_size,column_labels_font_size,row_group_font_size,stub_font_size,footnotes_font_size,source_notes_font_size The font sizes for the parent text element table and the following child elements: heading_title, heading_subtitle, column_labels, row_group, footnotes, and source_notes. Can be specified as a string with units of pixels (e.g., \"12px\") or as a percentage (e.g., \"80%\"). If provided as a scalar numeric value, it is assumed that the value is given in units of pixels. The px() and pct() helper functions can also be used to pass in numeric values and obtain values as pixel or percentage units. heading_align Controls the horizontal alignment of the heading title and subtitle. We can either use \"center\", \"left\", or \"right\". table_font_weight,heading_title_font_weight,heading_subtitle_font_weight,column_labels_font_weight,row_group_font_weight,stub_font_weight The font weights of the table, heading_title, heading_subtitle, column_labels, row_group, and stub text elements. 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. column_labels_text_transform,row_group_text_transform,stub_text_transform,summary_row_text_transform,grand_summary_row_text_transform Options to apply text transformations to the column_labels, row_group, stub, summary_row, and grand_summary_row text elements. Either of the \"uppercase\", \"lowercase\", or \"capitalize\" keywords can be used. heading_padding,column_labels_padding,data_row_padding,row_group_padding,summary_row_padding,grand_summary_row_padding,footnotes_padding,source_notes_padding The amount of vertical padding to incorporate in the heading (title and subtitle), the column_labels (this includes the column spanners), the row group labels (row_group_padding), in the body/stub rows (data_row_padding), in summary rows (summary_row_padding or grand_summary_row_padding), or in the footnotes and source notes (footnotes_padding and source_notes_padding). heading_padding_horizontal,column_labels_padding_horizontal,data_row_padding_horizontal,row_group_padding_horizontal,summary_row_padding_horizontal,grand_summary_row_padding_horizontal,footnotes_padding_horizontal,source_notes_padding_horizontal The amount of horizontal padding to incorporate in the heading (title and subtitle), the column_labels (this includes the column spanners), the row group labels (row_group_padding_horizontal), in the body/stub rows (data_row_padding), in summary rows (summary_row_padding_horizontal or grand_summary_row_padding_horizontal), or in the footnotes and source notes (footnotes_padding_horizontal and source_notes_padding_horizontal). table_border_top_style,table_border_top_width,table_border_top_color,table_border_right_style,table_border_right_width,table_border_right_color,table_border_bottom_style,table_border_bottom_width,table_border_bottom_color,table_border_left_style,table_border_left_width,table_border_left_color The style, width, and color properties of the table’s absolute top and absolute bottom borders. heading_border_bottom_style,heading_border_bottom_width,heading_border_bottom_color The style, width, and color properties of the header’s bottom border. This border shares space with that of the column_labels location. If the width of this border is larger, then it will be the visible border. heading_border_lr_style,heading_border_lr_width,heading_border_lr_color The style, width, and color properties for the left and right borders of the heading location. column_labels_vlines_style,column_labels_vlines_width,column_labels_vlines_color The style, width, and color properties for all vertical lines (‘vlines’) of the the column_labels. column_labels_border_top_style,column_labels_border_top_width,column_labels_border_top_color The style, width, and color properties for the top border of the column_labels location. This border shares space with that of the heading location. If the width of this border is larger, then it will be the visible border. column_labels_border_bottom_style,column_labels_border_bottom_width,column_labels_border_bottom_color The style, width, and color properties for the bottom border of the column_labels location. column_labels_border_lr_style,column_labels_border_lr_width,column_labels_border_lr_color The style, width, and color properties for the left and right borders of the column_labels location. column_labels_hidden An 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. row_group_border_top_style,row_group_border_top_width,row_group_border_top_color,row_group_border_bottom_style,row_group_border_bottom_width,row_group_border_bottom_color,row_group_border_left_style,row_group_border_left_width,row_group_border_left_color,row_group_border_right_style,row_group_border_right_width,row_group_border_right_color The style, width, and color properties for all top, bottom, left, and right borders of the row_group location. table_body_hlines_style,table_body_hlines_width,table_body_hlines_color,table_body_vlines_style,table_body_vlines_width,table_body_vlines_color The style, width, and color properties for all horizontal lines (‘hlines’) and vertical lines (‘vlines’) in the table_body. table_body_border_top_style,table_body_border_top_width,table_body_border_top_color,table_body_border_bottom_style,table_body_border_bottom_width,table_body_border_bottom_color The style, width, and color properties for all top and bottom borders of the table_body location. stub_border_style,stub_border_width,stub_border_color The style, width, and color properties for the vertical border of the table stub. stub_row_group_font_size,stub_row_group_font_weight,stub_row_group_text_transform,stub_row_group_border_style,stub_row_group_border_width,stub_row_group_border_color Options for the row group column in the stub (made possible when using row_group_as_column = TRUE). The defaults for these options mirror that of the stub.* variants (except for stub_row_group_border_width, which is \"1px\" instead of \"2px\"). row_group_default_label An option to set a default row group label for any rows not formally placed in a row group named by group in any call of tab_row_group(). If this is set as None and there are rows that haven’t been placed into a row group (where one or more row groups already exist), those rows will be automatically placed into a row group without a label. row_group_as_column How should row groups be structured? By default, they are separate rows that lie above the each of the groups. Setting this to True will structure row group labels are columns to the far left of the table. summary_row_border_style,summary_row_border_width,summary_row_border_color The style, width, and color properties for all horizontal borders of the summary_row location. grand_summary_row_border_style,grand_summary_row_border_width,grand_summary_row_border_color The style, width, and color properties for the top borders of the grand_summary_row location. footnotes_border_bottom_style,footnotes_border_bottom_width,footnotes_border_bottom_color The style, width, and color properties for the bottom border of the footnotes location. footnotes_border_lr_style,footnotes_border_lr_width,footnotes_border_lr_color The style, width, and color properties for the left and right borders of the footnotes location. footnotes_marks The set of sequential marks used to reference and identify each of the footnotes (same input as the [opt_footnote_marks()] function. We can supply a list that represents the series of footnote marks. This list is recycled when its usage goes beyond the length of the set. At each cycle, the marks are simply combined (e.g., * -> ** -> ***). The option exists for providing keywords for certain types of footnote marks. The keyword \"numbers\" (the default, indicating that we want to use numeric marks). We can use lowercase \"letters\" or uppercase \"LETTERS\". There is the option for using a traditional symbol set where \"standard\" provides four symbols, and, \"extended\" adds two more symbols, making six. footnotes_multiline,source_notes_multiline An option to either put footnotes and source notes in separate lines (the default, or True) or render them as a continuous line of text with footnotes_sep providing the separator (by default \" \") between notes. footnotes_sep,source_notes_sep The separating characters between adjacent footnotes and source notes in their respective footer sections when rendered as a continuous line of text (when footnotes_multiline is False). The default value is a single space character (\" \"). source_notes_border_bottom_style,source_notes_border_bottom_width,source_notes_border_bottom_color The style, width, and color properties for the bottom border of the source_notes location. source_notes_border_lr_style,source_notes_border_lr_width,source_notes_border_lr_color The style, width, and color properties for the left and right borders of the source_notes location. row_striping_background_color The background color for striped table body rows. A color name or a hexadecimal color code should be provided. row_striping_include_stub An option for whether to include the stub when striping rows. row_striping_include_table_body An option for whether to include the table body when striping rows. page_orientation For RTF output, this provides an two options for page orientation: \"portrait\" (the default) and \"landscape\". page_numbering Within RTF output, should page numbering be displayed? By default, this is set to False but if True then page numbering text will be added to the document header. page_header_use_tbl_headings If True then RTF output tables will migrate all table headings (including the table title and all column labels) to the page header. This page header content will repeat across pages. By default, this is False. page_footer_use_tbl_notes If True then RTF output tables will migrate all table footer content (this includes footnotes and source notes) to the page footer. This page footer content will repeat across pages. By default, this is False. page_width,page_height The page width and height in the standard portrait orientation. This is for RTF table output and the default values (in inches) are 8.5in and 11.0in. page_margin_left,page_margin_right,page_margin_top,page_margin_bottom For RTF table output, these options correspond to the left, right, top, and bottom page margins. The default values for each of these is 1.0in. page_header_height,page_footer_height The heights of the page header and footer for RTF table outputs. Default values for both are 0.5in.\nNone\n\n\n\n\n\n\n\n\n\nType\nDescription\n\n\n\n\nGT\nResult of the table operation." }, { - "objectID": "reference/GT.fmt_integer.html", - "href": "reference/GT.fmt_integer.html", - "title": "GT.fmt_integer", + "objectID": "reference/GT.tab_options.html#parameters", + "href": "reference/GT.tab_options.html#parameters", + "title": "GT.tab_options", "section": "", - "text": "GT.fmt_integer\nFormat values as integers.\nWith numeric values in a gt table, 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\n\ncolumns : Union[str, List[str], None], optional The columns to target. Can either be a single column name or a series of column names provided in a list.\nrows : Union[int, List[int], None], optional In 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.\nscale_by : float, optional All 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.\n\n\n\nGTData The GTData object is returned." + "text": "Name\nType\nDescription\nDefault\n\n\n\n\ncontainer_width\nOptional[str]\nThe width and height 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. The px() and pct() helper functions can also be used to pass in numeric values and obtain values as pixel or percent units.\nNone\n\n\ncontainer_overflow_x\nOptional[str]\nOptions to enable scrolling in the horizontal and vertical directions when the table content overflows the container dimensions. Using True (the default for both) means that horizontal or vertical 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 or container_height. table_width The width of the table. 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. The px() and pct() helper functions can also be used to pass in numeric values and obtain values as pixel or percent units. table_layout The value for the table-layout CSS style in the HTML output context. By default, this is \"fixed\" but another valid option is \"auto\". table_align The horizontal alignment of the table in its container. By default, this is \"center\". Other options are \"left\" and \"right\". This will automatically set table_margin_left and table_margin_right to the appropriate values. table_margin_left,table_margin_right The size of the margins on the left and right of the table within the 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. The px() and pct() helper functions can also be used to pass in numeric values and obtain values as pixel or percent units. Using table_margin_left or table_margin_right will overwrite any values set by table_align. table_background_color,heading_background_color,column_labels_background_color,row_group_background_color,stub_background_color,summary_row_background_color,grand_summary_row_background_color,footnotes_background_color,source_notes_background_color Background colors for the parent element table and the following child elements: heading, column_labels, row_group, stub, summary_row, grand_summary_row, footnotes, and source_notes. A color name or a hexadecimal color code should be provided. table_additional_css This option can be used to supply an additional block of CSS rules to be applied after the automatically generated table CSS. table_font_names The 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). table_font_style The font style for the table. Can be one of either \"normal\", \"italic\", or \"oblique\". table_font_color,table_font_color_light The text color used throughout the table. There are two variants: table_font_color is for text overlaid on lighter background colors, and table_font_color_light is automatically used when text needs to be overlaid on darker background colors. A color name or a hexadecimal color code should be provided. table_font_size,heading_title_font_size,heading_subtitle_font_size,column_labels_font_size,row_group_font_size,stub_font_size,footnotes_font_size,source_notes_font_size The font sizes for the parent text element table and the following child elements: heading_title, heading_subtitle, column_labels, row_group, footnotes, and source_notes. Can be specified as a string with units of pixels (e.g., \"12px\") or as a percentage (e.g., \"80%\"). If provided as a scalar numeric value, it is assumed that the value is given in units of pixels. The px() and pct() helper functions can also be used to pass in numeric values and obtain values as pixel or percentage units. heading_align Controls the horizontal alignment of the heading title and subtitle. We can either use \"center\", \"left\", or \"right\". table_font_weight,heading_title_font_weight,heading_subtitle_font_weight,column_labels_font_weight,row_group_font_weight,stub_font_weight The font weights of the table, heading_title, heading_subtitle, column_labels, row_group, and stub text elements. 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. column_labels_text_transform,row_group_text_transform,stub_text_transform,summary_row_text_transform,grand_summary_row_text_transform Options to apply text transformations to the column_labels, row_group, stub, summary_row, and grand_summary_row text elements. Either of the \"uppercase\", \"lowercase\", or \"capitalize\" keywords can be used. heading_padding,column_labels_padding,data_row_padding,row_group_padding,summary_row_padding,grand_summary_row_padding,footnotes_padding,source_notes_padding The amount of vertical padding to incorporate in the heading (title and subtitle), the column_labels (this includes the column spanners), the row group labels (row_group_padding), in the body/stub rows (data_row_padding), in summary rows (summary_row_padding or grand_summary_row_padding), or in the footnotes and source notes (footnotes_padding and source_notes_padding). heading_padding_horizontal,column_labels_padding_horizontal,data_row_padding_horizontal,row_group_padding_horizontal,summary_row_padding_horizontal,grand_summary_row_padding_horizontal,footnotes_padding_horizontal,source_notes_padding_horizontal The amount of horizontal padding to incorporate in the heading (title and subtitle), the column_labels (this includes the column spanners), the row group labels (row_group_padding_horizontal), in the body/stub rows (data_row_padding), in summary rows (summary_row_padding_horizontal or grand_summary_row_padding_horizontal), or in the footnotes and source notes (footnotes_padding_horizontal and source_notes_padding_horizontal). table_border_top_style,table_border_top_width,table_border_top_color,table_border_right_style,table_border_right_width,table_border_right_color,table_border_bottom_style,table_border_bottom_width,table_border_bottom_color,table_border_left_style,table_border_left_width,table_border_left_color The style, width, and color properties of the table’s absolute top and absolute bottom borders. heading_border_bottom_style,heading_border_bottom_width,heading_border_bottom_color The style, width, and color properties of the header’s bottom border. This border shares space with that of the column_labels location. If the width of this border is larger, then it will be the visible border. heading_border_lr_style,heading_border_lr_width,heading_border_lr_color The style, width, and color properties for the left and right borders of the heading location. column_labels_vlines_style,column_labels_vlines_width,column_labels_vlines_color The style, width, and color properties for all vertical lines (‘vlines’) of the the column_labels. column_labels_border_top_style,column_labels_border_top_width,column_labels_border_top_color The style, width, and color properties for the top border of the column_labels location. This border shares space with that of the heading location. If the width of this border is larger, then it will be the visible border. column_labels_border_bottom_style,column_labels_border_bottom_width,column_labels_border_bottom_color The style, width, and color properties for the bottom border of the column_labels location. column_labels_border_lr_style,column_labels_border_lr_width,column_labels_border_lr_color The style, width, and color properties for the left and right borders of the column_labels location. column_labels_hidden An 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. row_group_border_top_style,row_group_border_top_width,row_group_border_top_color,row_group_border_bottom_style,row_group_border_bottom_width,row_group_border_bottom_color,row_group_border_left_style,row_group_border_left_width,row_group_border_left_color,row_group_border_right_style,row_group_border_right_width,row_group_border_right_color The style, width, and color properties for all top, bottom, left, and right borders of the row_group location. table_body_hlines_style,table_body_hlines_width,table_body_hlines_color,table_body_vlines_style,table_body_vlines_width,table_body_vlines_color The style, width, and color properties for all horizontal lines (‘hlines’) and vertical lines (‘vlines’) in the table_body. table_body_border_top_style,table_body_border_top_width,table_body_border_top_color,table_body_border_bottom_style,table_body_border_bottom_width,table_body_border_bottom_color The style, width, and color properties for all top and bottom borders of the table_body location. stub_border_style,stub_border_width,stub_border_color The style, width, and color properties for the vertical border of the table stub. stub_row_group_font_size,stub_row_group_font_weight,stub_row_group_text_transform,stub_row_group_border_style,stub_row_group_border_width,stub_row_group_border_color Options for the row group column in the stub (made possible when using row_group_as_column = TRUE). The defaults for these options mirror that of the stub.* variants (except for stub_row_group_border_width, which is \"1px\" instead of \"2px\"). row_group_default_label An option to set a default row group label for any rows not formally placed in a row group named by group in any call of tab_row_group(). If this is set as None and there are rows that haven’t been placed into a row group (where one or more row groups already exist), those rows will be automatically placed into a row group without a label. row_group_as_column How should row groups be structured? By default, they are separate rows that lie above the each of the groups. Setting this to True will structure row group labels are columns to the far left of the table. summary_row_border_style,summary_row_border_width,summary_row_border_color The style, width, and color properties for all horizontal borders of the summary_row location. grand_summary_row_border_style,grand_summary_row_border_width,grand_summary_row_border_color The style, width, and color properties for the top borders of the grand_summary_row location. footnotes_border_bottom_style,footnotes_border_bottom_width,footnotes_border_bottom_color The style, width, and color properties for the bottom border of the footnotes location. footnotes_border_lr_style,footnotes_border_lr_width,footnotes_border_lr_color The style, width, and color properties for the left and right borders of the footnotes location. footnotes_marks The set of sequential marks used to reference and identify each of the footnotes (same input as the [opt_footnote_marks()] function. We can supply a list that represents the series of footnote marks. This list is recycled when its usage goes beyond the length of the set. At each cycle, the marks are simply combined (e.g., * -> ** -> ***). The option exists for providing keywords for certain types of footnote marks. The keyword \"numbers\" (the default, indicating that we want to use numeric marks). We can use lowercase \"letters\" or uppercase \"LETTERS\". There is the option for using a traditional symbol set where \"standard\" provides four symbols, and, \"extended\" adds two more symbols, making six. footnotes_multiline,source_notes_multiline An option to either put footnotes and source notes in separate lines (the default, or True) or render them as a continuous line of text with footnotes_sep providing the separator (by default \" \") between notes. footnotes_sep,source_notes_sep The separating characters between adjacent footnotes and source notes in their respective footer sections when rendered as a continuous line of text (when footnotes_multiline is False). The default value is a single space character (\" \"). source_notes_border_bottom_style,source_notes_border_bottom_width,source_notes_border_bottom_color The style, width, and color properties for the bottom border of the source_notes location. source_notes_border_lr_style,source_notes_border_lr_width,source_notes_border_lr_color The style, width, and color properties for the left and right borders of the source_notes location. row_striping_background_color The background color for striped table body rows. A color name or a hexadecimal color code should be provided. row_striping_include_stub An option for whether to include the stub when striping rows. row_striping_include_table_body An option for whether to include the table body when striping rows. page_orientation For RTF output, this provides an two options for page orientation: \"portrait\" (the default) and \"landscape\". page_numbering Within RTF output, should page numbering be displayed? By default, this is set to False but if True then page numbering text will be added to the document header. page_header_use_tbl_headings If True then RTF output tables will migrate all table headings (including the table title and all column labels) to the page header. This page header content will repeat across pages. By default, this is False. page_footer_use_tbl_notes If True then RTF output tables will migrate all table footer content (this includes footnotes and source notes) to the page footer. This page footer content will repeat across pages. By default, this is False. page_width,page_height The page width and height in the standard portrait orientation. This is for RTF table output and the default values (in inches) are 8.5in and 11.0in. page_margin_left,page_margin_right,page_margin_top,page_margin_bottom For RTF table output, these options correspond to the left, right, top, and bottom page margins. The default values for each of these is 1.0in. page_header_height,page_footer_height The heights of the page header and footer for RTF table outputs. Default values for both are 0.5in.\nNone" }, { - "objectID": "reference/GT.fmt_integer.html#parameters", - "href": "reference/GT.fmt_integer.html#parameters", - "title": "GT.fmt_integer", + "objectID": "reference/GT.tab_options.html#returns", + "href": "reference/GT.tab_options.html#returns", + "title": "GT.tab_options", "section": "", - "text": "columns : Union[str, List[str], None], optional The columns to target. Can either be a single column name or a series of column names provided in a list.\nrows : Union[int, List[int], None], optional In 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.\nscale_by : float, optional All 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." + "text": "Type\nDescription\n\n\n\n\nGT\nResult of the table operation." }, { - "objectID": "reference/GT.fmt_integer.html#returns", - "href": "reference/GT.fmt_integer.html#returns", - "title": "GT.fmt_integer", + "objectID": "reference/md.html", + "href": "reference/md.html", + "title": "md", "section": "", - "text": "GTData The GTData object is returned." + "text": "md\nmd(text)\nInterpret input text as Markdown-formatted text.\nMarkdown! It’s a wonderful thing. We can use it in certain places (e.g., footnotes, source notes, the table title, etc.) and expect it to render to HTML as Markdown does. There is the html() helper that allows you to ferry in HTML but this function md()… it’s almost like a two-for-one deal (you get to use Markdown plus any HTML fragments at the same time).\nArgs: text (str): The text that is understood to contain Markdown formatting.\nReturns: Text: An instance of the Text class is returned, where the text type is ‘markdown’." }, { "objectID": "reference/data.exibble.html", @@ -147,25 +112,32 @@ "text": "data.exibble\ndata.exibble\nA toy example table for testing with gt: exibble\nThis table contains data of a few different classes, which makes it well-suited for quick experimentation with the functions in this package. It contains only eight rows with numeric and character columns. The last 4 rows contain missing values in the majority of this table’s columns (1 missing value per column). The date, time, and datetime columns are character-based dates/times in the familiar ISO 8601 format. The row and group columns provide for unique rownames and two groups (grp_a and grp_b) for experimenting with the rowname_col and groupname_col arguments." }, { - "objectID": "reference/GT.fmt_number.html", - "href": "reference/GT.fmt_number.html", - "title": "GT.fmt_number", + "objectID": "reference/GT.tab_source_note.html", + "href": "reference/GT.tab_source_note.html", + "title": "GT.tab_source_note", "section": "", - "text": "GT.fmt_number\nFormat numeric values.\nWith numeric values in a gt table, 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\n\ncolumns : Union[str, List[str], None], optional The columns to target. Can either be a single column name or a series of column names provided in a list.\nrows : Union[int, List[int], None], optional In 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.\ndecimals : int, optional The 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.\nn_sigfig : Optional[int], optional A 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.\ndrop_trailing_zeros : bool, optional A boolean value that allows for removal of trailing zeros (those redundant zeros after the decimal mark).\ndrop_trailing_dec_mark : bool, optional A 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.\nscale_by : float, optional All 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.\nsep_mark : str, optional The 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).\ndec_mark : str, optional The 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\nGTData The GTData object is returned." + "text": "GT.tab_source_note(source_note)\nAdd a source note citation.\nAdd a source note to the footer part of the gt table. A source note is useful for citing the data included in the table. Several can be added to the footer, simply use multiple calls of tab_source_note() 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\n\n\n\n\n\n\n\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\nsource_note\nstr\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\n\n\n\n\nType\nDescription\n\n\n\n\nGT\nResult of the table operation.\n\n\n\n\n\n\n>>> from gt import *\n>>> x = GT([{\"a\": 5, \"b\": 10}, {\"a\": 15, \"b\": 20}])\n>>> .tab_source_note(source_note=\"Source note for the table.\")\n>>> x\n>>> print(x)" }, { - "objectID": "reference/GT.fmt_number.html#parameters", - "href": "reference/GT.fmt_number.html#parameters", - "title": "GT.fmt_number", + "objectID": "reference/GT.tab_source_note.html#parameters", + "href": "reference/GT.tab_source_note.html#parameters", + "title": "GT.tab_source_note", "section": "", - "text": "columns : Union[str, List[str], None], optional The columns to target. Can either be a single column name or a series of column names provided in a list.\nrows : Union[int, List[int], None], optional In 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.\ndecimals : int, optional The 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.\nn_sigfig : Optional[int], optional A 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.\ndrop_trailing_zeros : bool, optional A boolean value that allows for removal of trailing zeros (those redundant zeros after the decimal mark).\ndrop_trailing_dec_mark : bool, optional A 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.\nscale_by : float, optional All 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.\nsep_mark : str, optional The 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).\ndec_mark : str, optional The 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)." + "text": "Name\nType\nDescription\nDefault\n\n\n\n\nsource_note\nstr\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" }, { - "objectID": "reference/GT.fmt_number.html#returns", - "href": "reference/GT.fmt_number.html#returns", - "title": "GT.fmt_number", + "objectID": "reference/GT.tab_source_note.html#returns", + "href": "reference/GT.tab_source_note.html#returns", + "title": "GT.tab_source_note", "section": "", - "text": "GTData The GTData object is returned." + "text": "Type\nDescription\n\n\n\n\nGT\nResult of the table operation." + }, + { + "objectID": "reference/GT.tab_source_note.html#examples", + "href": "reference/GT.tab_source_note.html#examples", + "title": "GT.tab_source_note", + "section": "", + "text": ">>> from gt import *\n>>> x = GT([{\"a\": 5, \"b\": 10}, {\"a\": 15, \"b\": 20}])\n>>> .tab_source_note(source_note=\"Source note for the table.\")\n>>> x\n>>> print(x)" }, { "objectID": "reference/data.gtcars.html", @@ -174,20 +146,6 @@ "section": "", "text": "data.gtcars\ndata.gtcars\nDeluxe automobiles from the 2014-2017 period\nExpensive and fast cars. Each row describes a car of a certain make, model, year, and trim. Basic specifications such as horsepower, torque, EPA MPG ratings, type of drivetrain, and transmission characteristics are provided. The country of origin for the car manufacturer is also given." }, - { - "objectID": "reference/data.sza.html", - "href": "reference/data.sza.html", - "title": "data.sza", - "section": "", - "text": "data.sza\ndata.sza\nTwice hourly solar zenith angles by month & latitude\nThis dataset contains solar zenith angles (in degrees, with the range of 0-90) every half hour from 04:00 to 12:00, true solar time. This set of values is calculated on the first of every month for 4 different northern hemisphere latitudes. For determination of afternoon values, the presented tabulated values are symmetric about noon." - }, - { - "objectID": "reference/html.html", - "href": "reference/html.html", - "title": "html", - "section": "", - "text": "html\nhtml(text)\nInterpret input text as HTML-formatted text.\nFor certain pieces of text (like in column labels or table headings) we may want to express them as raw HTML. In fact, with HTML, anything goes so it can be much more than just text. The html() function will guard the input HTML against escaping, so, your HTML tags will come through as HTML when rendered… to HTML.\nArgs: text (str): The text that is understood to contain HTML formatting.\nReturns: Text: An instance of the Text class is returned, where the text type is ‘html’." - }, { "objectID": "reference/GT.cols_label.html", "href": "reference/GT.cols_label.html", @@ -203,172 +161,151 @@ "text": "Type\nDescription\n\n\n\n\nGT\nResult of the table operation." }, { - "objectID": "reference/md.html", - "href": "reference/md.html", - "title": "md", - "section": "", - "text": "md\nmd(text)\nInterpret input text as Markdown-formatted text.\nMarkdown! It’s a wonderful thing. We can use it in certain places (e.g., footnotes, source notes, the table title, etc.) and expect it to render to HTML as Markdown does. There is the html() helper that allows you to ferry in HTML but this function md()… it’s almost like a two-for-one deal (you get to use Markdown plus any HTML fragments at the same time).\nArgs: text (str): The text that is understood to contain Markdown formatting.\nReturns: Text: An instance of the Text class is returned, where the text type is ‘markdown’." - }, - { - "objectID": "examples-qmd/tab-spanner.html", - "href": "examples-qmd/tab-spanner.html", - "title": "great_tables", - "section": "", - "text": "from siuba import *\nimport great_tables as gt\n\n\ndf = (\n gt.gtcars\n >> select(~_.mfr, ~_.trim, _.bdy_style, ~_.drivetrain, ~_.trsmn, ~_.ctry_origin)\n >> head(n = 10)\n)\n\n\n(gt.GT(df, rowname_col = \"model\")\n .tab_spanner(\n label = \"performance\",\n columns = [\"hp\", \"hp_rpm\", \"trq\", \"trq_rpm\", \"mpg_c\", \"mpg_h\"]\n )\n)\n\n\ndf2 = (\n gt.towny\n >> arrange(-_.population_2021)\n >> head(n = 5)\n >> select(_.name, _.latitude, _.longitude, _.endswith(\"2016\"), _.endswith(\"2021\"))\n)\n\n(gt.GT(df2)\n .tab_spanner(label = \"Population\", columns=_.startswith(\"pop\"))\n .tab_spanner(label = \"Density\", columns = _.startswith(\"den\"))\n .tab_spanner(label = gt.md(\"*Location*\"), columns = _.endswith(\"itude\"), id=\"loc\")\n)\n\n\nexibble_narrow = gt.exibble >> head(n = 3)\n\n\n(gt.GT(exibble_narrow)\n .tab_spanner(label = \"Row Information\", columns = _[\"row\", \"group\"])\n # TODO: tidyselect numeric columns\n .tab_spanner(label = \"Numeric Values\", columns = [\"num\", \"currency\"], id = \"num_spanner\")\n .tab_spanner(label = \"Text Values\", columns = [\"char\", \"fctr\"], id = \"text_spanner\")\n .tab_spanner(label = \"Numbers and Text\", spanners = [\"num_spanner\", \"text_spanner\"])\n)\n\n\nexibble_narrow_gt = (gt.GT(exibble_narrow)\n .tab_spanner(label = \"Numeric Values\", columns = [\"num\", \"currency\"], id = \"num_spanner\")\n .tab_spanner(label = \"Text Values\", columns = (\"char\", \"fctr\"), id = \"text_spanner\")\n .tab_spanner(\n label = \"Text, Dates, Times, Datetimes\",\n # TODO: what is the RE flag name?\n columns = _.contains(\"date|time\", re = True),\n spanners = \"text_spanner\"\n )\n)\n\nexibble_narrow_gt\n\n\n(exibble_narrow_gt\n .tab_spanner(\n label = \"Date and Time Columns\",\n columns = _.contains(\"date|time\"),\n id = \"date_time_spanner\"\n )\n)\n\n\n(exibble_narrow_gt\n .tab_spanner(\n label = \"Date and Time Columns\",\n columns = _.contains(\"date|time\"),\n level = 1,\n id = \"date_time_spanner\"\n )\n)\n\n\nlil_towny = (gt.towny\n >> select(\n _.name, _.endswith(\"2001\"), _.endswith(\"2006\"), _.contains(\"2001_2006\")\n )\n >> filter(_.population_2001 > 100000)\n >> arrange(-_.pop_change_2001_2006_pct)\n >> head(n = 10)\n)\n\n(gt.GT(lil_towny)\n .fmt_integer() |>\n .fmt_percent(columns = _.contains(\"change\"), decimals = 1)\n .tab_spanner(\n label = \"Population\",\n columns = _.startswith(\"population\")\n )\n .tab_spanner(\n label = \"Density, {{*persons* km^-2}}\",\n columns = _.startswith(\"density\")\n )\n .cols_label(\n {\n _.endswith(\"01\"): \"2001\",\n _.endswith(\"06\"): \"2006\",\n _.contains(\"change\"): md(\"Population Change,<br>2001 to 2006\")\n }\n )\n .cols_width(\n {_.everything(): px(120)}\n # Alternatively, we could do this syntax:\n # _.everything().label(px(120))\n )\n)" - }, - { - "objectID": "examples-qmd/fmt-number.html", - "href": "examples-qmd/fmt-number.html", - "title": "great_tables", - "section": "", - "text": "import great_tables as gt\nfrom great_tables import exibble, countrypops\n\nUse the exibble dataset to create a gt 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\ngt.GT(exibble).fmt_number(columns='num', decimals=3).cols_label(char = \"character\")\n\n/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/great_tables/_tbl_data.py:142: SettingWithCopyWarning: \nA value is trying to be set on a copy of a slice from a DataFrame\n\nSee the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n data[column][row] = value\n\n\n\n\n\n\n\n\n\nnum\ncharacter\nfctr\ndate\ntime\ndatetime\ncurrency\nrow\ngroup\n\n\n\n\n0.111\napricot\none\n2015-01-15\n13:35\n2018-01-01 02:22\n49.95\nrow_1\ngrp_a\n\n\n2.222\nbanana\ntwo\n2015-02-15\n14:40\n2018-02-02 14:33\n17.95\nrow_2\ngrp_a\n\n\n33.330\ncoconut\nthree\n2015-03-15\n15:45\n2018-03-03 03:44\n1.39\nrow_3\ngrp_a\n\n\n444.400\ndurian\nfour\n2015-04-15\n16:50\n2018-04-04 15:55\n65100.0\nrow_4\ngrp_a\n\n\n5,550.000\nnan\nfive\n2015-05-15\n17:55\n2018-05-05 04:00\n1325.81\nrow_5\ngrp_b\n\n\nnan\nfig\nsix\n2015-06-15\nnan\n2018-06-06 16:11\n13.255\nrow_6\ngrp_b\n\n\n777,000.000\ngrapefruit\nseven\nnan\n19:10\n2018-07-07 05:22\nnan\nrow_7\ngrp_b\n\n\n8,880,000.000\nhoneydew\neight\n2015-08-15\n20:20\nnan\n0.44\nrow_8\ngrp_b\n\n\n\n\n\n\n \n\n\nUse a modified version of the countrypops dataset to create a gt table with row labels. Format all columns to use large-number suffixing (e.g., where '10,000,000' becomes '10M') with the suffixing=True option.\n\nfrom siuba import *\nres = (countrypops\n >> select(_.country_code_3, _.year, _.population)\n >> filter(_.country_code_3.isin(['CHN', 'IND', 'USA', 'PAK', 'IDN']))\n >> filter(_.year > 1975, _.year % 5 == 0)\n >> spread(_.year, _.population)\n >> arrange(-_[2015])\n)\n\n# TODO: implement `suffixing`\n(gt.GT(res)\n .fmt_integer(columns=1980, scale_by=1/10000)\n .fmt_number(columns=1985)\n)\n\nTypeError: Invalid value '98124' for dtype Int64\n\n\nGT(_tbl_data= country_code_3 1980 1985 1990 1995 2000 \\\n0 CHN 981235000 1051040000 1135185000 1204855000 1262645000 \n2 IND 696828385 780242084 870452165 964279129 1059633675 \n4 USA 227225000 237924000 249623000 266278000 282162411 \n1 IDN 148177096 165791694 182159874 198140162 214072421 \n3 PAK 80624057 97121552 115414069 133117476 154369924 \n\n 2005 2010 2015 2020 \n0 1303720000 1337705000 1379860000 1411100000 \n2 1154638713 1240613620 1322866505 1396387127 \n4 295516599 309327143 320738994 331511512 \n1 228805144 244016173 259091970 271857970 \n3 174372098 194454498 210969298 227196741 , _body=<great_tables._gt_data.Body object at 0x7fa4bd747c10>, _boxhead=Boxhead([<great_tables._gt_data.ColInfo object at 0x7fa4bd79f310>, <great_tables._gt_data.ColInfo object at 0x7fa4bd79f370>, <great_tables._gt_data.ColInfo object at 0x7fa4bd79f6d0>, <great_tables._gt_data.ColInfo object at 0x7fa4bd79e860>, <great_tables._gt_data.ColInfo object at 0x7fa4bd79ece0>, <great_tables._gt_data.ColInfo object at 0x7fa4bd79f280>, <great_tables._gt_data.ColInfo object at 0x7fa4bd79f3d0>, <great_tables._gt_data.ColInfo object at 0x7fa4bd79f1c0>, <great_tables._gt_data.ColInfo object at 0x7fa4bd79fca0>, <great_tables._gt_data.ColInfo object at 0x7fa4bd79e950>]), _stub=Stub([RowInfo(rownum_i=0, group_id=None, rowname=None, group_label=None, built=False), RowInfo(rownum_i=1, group_id=None, rowname=None, group_label=None, built=False), RowInfo(rownum_i=2, group_id=None, rowname=None, group_label=None, built=False), RowInfo(rownum_i=3, group_id=None, rowname=None, group_label=None, built=False), RowInfo(rownum_i=4, group_id=None, rowname=None, group_label=None, built=False)]), _row_groups=RowGroups([]), _spanners=<great_tables._gt_data.Spanners object at 0x7fa4bd79f100>, _heading=<great_tables._gt_data.Heading object at 0x7fa4bd79e830>, _stubhead=<great_tables._gt_data.Stubhead object at 0x7fa4bd79f130>, _source_notes=<great_tables._gt_data.SourceNotes object at 0x7fa4bd79eec0>, _footnotes=<great_tables._gt_data.Footnotes object at 0x7fa4bd79ed40>, _styles=<great_tables._gt_data.Styles object at 0x7fa4bd79fc70>, _locale=<great_tables._gt_data.Locale object at 0x7fa4bd79fd00>, _formats=[<great_tables._gt_data.FormatInfo object at 0x7fa4bd5e0100>, <great_tables._gt_data.FormatInfo object at 0x7fa4bd5e0250>], _options=<great_tables._gt_data.Options object at 0x7fa4bd79fb80>, _has_built=False)\n\n\nIn a variation of the previous table, we can combine large-number suffixing with a declaration of the number of significant digits to use. With things like population figures, n_sigfig=3 is a very good option.\n\n#countrypops |>\n# dplyr::select(country_code_3, year, population) |>\n# dplyr::filter(country_code_3 %in% c('CHN', 'IND', 'USA', 'PAK', 'IDN')) |>\n# dplyr::filter(year > 1975 & year %% 5 == 0) |>\n# tidyr::spread(year, population) |>\n# dplyr::arrange(desc(`2015`)) |>\n# gt(rowname_col='country_code_3') |>\n# fmt_number(suffixing=True, n_sigfig=3)\n\nThere can be cases where you want to show numbers to a large number of decimal places but also drop the unnecessary trailing zeros for low-precision values. Let’s take a portion of the towny dataset and format the latitude and longitude columns with fmt_number(). We’ll have up to 5 digits displayed as decimal values, but we’ll also unconditionally drop any runs of trailing zeros in the decimal part with drop_trailing_zeros=True.\n\ntowny |>\n dplyr::select(name, latitude, longitude) |>\n dplyr::slice_head(n=10) |>\n gt() |>\n fmt_number(decimals=5, drop_trailing_zeros=True) |>\n # replace -name with [latitude, longitude]\n ## cols_merge(columns=-name, pattern='{1}, {2}') |>\n cols_label(\n name~'Municipality',\n latitude='Location'\n )" - }, - { - "objectID": "examples-qmd/table-manipulation.html", - "href": "examples-qmd/table-manipulation.html", - "title": "great_tables", + "objectID": "reference/GT.fmt_number.html", + "href": "reference/GT.fmt_number.html", + "title": "GT.fmt_number", "section": "", - "text": "import great_tables as gt\nfrom great_tables import exibble, countrypops, gtcars # , md, html\n\nfrom siuba import *\n\n\nres = gtcars >> select(_.mfr, _.model, _.msrp) >> _.head(5)\n# TODO: Make `md()` work\ngt.GT(res).tab_header(\n title=\"Data listing from **gtcars**\", subtitle=\"`gtcars` is an R dataset\"\n).fmt_number(columns=\"msrp\", decimals=2, scale_by=1 / 10000)\n\nTypeError: Invalid value '44.70' for dtype Int64\n\n\nGT(_tbl_data= mfr model msrp\n0 Ford GT 447000\n1 Ferrari 458 Speciale 291744\n2 Ferrari 458 Spider 263553\n3 Ferrari 458 Italia 233509\n4 Ferrari 488 GTB 245400, _body=<great_tables._gt_data.Body object at 0x7f0201649180>, _boxhead=Boxhead([<great_tables._gt_data.ColInfo object at 0x7f0201648640>, <great_tables._gt_data.ColInfo object at 0x7f0201648c70>, <great_tables._gt_data.ColInfo object at 0x7f02016489d0>]), _stub=Stub([RowInfo(rownum_i=0, group_id=None, rowname=None, group_label=None, built=False), RowInfo(rownum_i=1, group_id=None, rowname=None, group_label=None, built=False), RowInfo(rownum_i=2, group_id=None, rowname=None, group_label=None, built=False), RowInfo(rownum_i=3, group_id=None, rowname=None, group_label=None, built=False), RowInfo(rownum_i=4, group_id=None, rowname=None, group_label=None, built=False)]), _row_groups=RowGroups([]), _spanners=<great_tables._gt_data.Spanners object at 0x7f02016491e0>, _heading=<great_tables._gt_data.Heading object at 0x7f0201649330>, _stubhead=<great_tables._gt_data.Stubhead object at 0x7f02016484f0>, _source_notes=<great_tables._gt_data.SourceNotes object at 0x7f02016491b0>, _footnotes=<great_tables._gt_data.Footnotes object at 0x7f0201649450>, _styles=<great_tables._gt_data.Styles object at 0x7f0201649690>, _locale=<great_tables._gt_data.Locale object at 0x7f02016496c0>, _formats=[<great_tables._gt_data.FormatInfo object at 0x7f0201661570>], _options=<great_tables._gt_data.Options object at 0x7f0201649660>, _has_built=False)\n\n\n\ngt.GT(exibble.iloc[[4, 3, 7, 1],], groupname_col=\"group\")\n\n\n\n\n\n\n\n\nnum\nchar\nfctr\ndate\ntime\ndatetime\ncurrency\nrow\ngroup\n\n\n\n\n5550.0\nnan\nfive\n2015-05-15\n17:55\n2018-05-05 04:00\n1325.81\nrow_5\ngrp_b\n\n\n8880000.0\nhoneydew\neight\n2015-08-15\n20:20\nnan\n0.44\nrow_8\ngrp_b\n\n\n444.4\ndurian\nfour\n2015-04-15\n16:50\n2018-04-04 15:55\n65100.0\nrow_4\ngrp_a\n\n\n2.222\nbanana\ntwo\n2015-02-15\n14:40\n2018-02-02 14:33\n17.95\nrow_2\ngrp_a\n\n\n\n\n\n\n \n\n\n\nres = gtcars >> select(_.mfr, _.model, _.msrp) >> _.head(5)\n\n# TODO: Make `html()` work\ngt.GT(res).tab_header(\n title=html(\"Data listing from <strong>gtcars</strong>\"),\n subtitle=html(\"From <span style='color:red;'>gtcars</span>\"),\n)" + "text": "GT.fmt_number\nFormat numeric values.\nWith numeric values in a gt table, 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\n\ncolumns : Union[str, List[str], None], optional The columns to target. Can either be a single column name or a series of column names provided in a list.\nrows : Union[int, List[int], None], optional In 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.\ndecimals : int, optional The 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.\nn_sigfig : Optional[int], optional A 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.\ndrop_trailing_zeros : bool, optional A boolean value that allows for removal of trailing zeros (those redundant zeros after the decimal mark).\ndrop_trailing_dec_mark : bool, optional A 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.\nscale_by : float, optional All 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.\nsep_mark : str, optional The 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).\ndec_mark : str, optional The 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\nGTData The GTData object is returned." }, { - "objectID": "examples-qmd/GT.html", - "href": "examples-qmd/GT.html", - "title": "great_tables", + "objectID": "reference/GT.fmt_number.html#parameters", + "href": "reference/GT.fmt_number.html#parameters", + "title": "GT.fmt_number", "section": "", - "text": "import great_tables as gt\nfrom great_tables import exibble\n\nLet’s use the exibble dataset for the next few examples, we’ll learn how to make simple gt tables with the GT() class. The most basic thing to do is to just use GT() with the dataset as the input.\n\ngt.GT(exibble)\n\n\n\n\n\n\n\n\nnum\nchar\nfctr\ndate\ntime\ndatetime\ncurrency\nrow\ngroup\n\n\n\n\n0.1111\napricot\none\n2015-01-15\n13:35\n2018-01-01 02:22\n49.95\nrow_1\ngrp_a\n\n\n2.222\nbanana\ntwo\n2015-02-15\n14:40\n2018-02-02 14:33\n17.95\nrow_2\ngrp_a\n\n\n33.33\ncoconut\nthree\n2015-03-15\n15:45\n2018-03-03 03:44\n1.39\nrow_3\ngrp_a\n\n\n444.4\ndurian\nfour\n2015-04-15\n16:50\n2018-04-04 15:55\n65100.0\nrow_4\ngrp_a\n\n\n5550.0\nnan\nfive\n2015-05-15\n17:55\n2018-05-05 04:00\n1325.81\nrow_5\ngrp_b\n\n\nnan\nfig\nsix\n2015-06-15\nnan\n2018-06-06 16:11\n13.255\nrow_6\ngrp_b\n\n\n777000.0\ngrapefruit\nseven\nnan\n19:10\n2018-07-07 05:22\nnan\nrow_7\ngrp_b\n\n\n8880000.0\nhoneydew\neight\n2015-08-15\n20:20\nnan\n0.44\nrow_8\ngrp_b\n\n\n\n\n\n\n \n\n\nThis 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 name of the column to use.\n\ngt.GT(exibble, rowname_col=\"row\")\n\nThis 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.\nThe group column can be used to divide the rows into discrete groups. Within that column, we see repetitions of the values 'grp_a' and 'grp_b'. These serve both as ID values and the initial label for the groups. With the groupname_col argument in GT(), we can set up the row groups immediately upon creation of the table.\n\ngt.GT(exibble, rowname_col=\"row\", groupname_col=\"group\")\n\nIf you’d rather perform the set up of row groups later (i.e., not in the GT() call), this is possible with use of the tab_row_group() method (and row_group_order() can help with the arrangement of row groups).\nOne more thing to consider with row groups is their layout. By default, row group labels reside in separate rows the appear above the group. However, we can use the row_group_as_column=True option to put the row group labels within a secondary column within the table stub.\n\ngt.GT(exibble, rowname_col=\"row\", groupname_col=\"group\", row_group_as_column=True)\n\nThis could be done later if need be, and using tab_options(row_group.as_column=True) would be the way to do it outside of the GT() call.\nSome datasets have rownames built in; mtcars has the car model names as the rownames. To use those rownames as row labels in the stub, the rownames_to_stub=TRUE option will prove to be useful.\n\ngt.GT(head(mtcars, 10), rownames_to_stub=True)\n\nBy default, values in the body of a gt 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.\n\ngt.GT(exibble, rowname_col=\"row\", auto_align=False)\n\nWhat 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.\nHowever which way you generate the initial gt table object, you can use it with a huge variety of methods in the package 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 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() and using formatting methods:\n\ngt.GT(\n exibble, rowname_col=\"row\", groupname_col=\"group\", locale=\"fr\"\n).fmt_number().fmt_date(columns=\"date\", date_style=\"yMEd\").fmt_datetime(\n columns=\"datetime\", format=\"EEEE, MMMM d, y\", locale=\"en\"\n)" + "text": "columns : Union[str, List[str], None], optional The columns to target. Can either be a single column name or a series of column names provided in a list.\nrows : Union[int, List[int], None], optional In 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.\ndecimals : int, optional The 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.\nn_sigfig : Optional[int], optional A 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.\ndrop_trailing_zeros : bool, optional A boolean value that allows for removal of trailing zeros (those redundant zeros after the decimal mark).\ndrop_trailing_dec_mark : bool, optional A 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.\nscale_by : float, optional All 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.\nsep_mark : str, optional The 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).\ndec_mark : str, optional The 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)." }, { - "objectID": "changelog.html", - "href": "changelog.html", - "title": "Changelog", + "objectID": "reference/GT.fmt_number.html#returns", + "href": "reference/GT.fmt_number.html#returns", + "title": "GT.fmt_number", "section": "", - "text": "I am the changelog" + "text": "GTData The GTData object is returned." }, { - "objectID": "reference/GT.opt_footnote_marks.html", - "href": "reference/GT.opt_footnote_marks.html", - "title": "GT.opt_footnote_marks", + "objectID": "reference/GT.opt_align_table_header.html", + "href": "reference/GT.opt_align_table_header.html", + "title": "GT.opt_align_table_header", "section": "", - "text": "GT.opt_footnote_marks(marks='numbers')\nOption to modify the set of footnote marks.\nAlter 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 function 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\n\n\n\n\n\n\n\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\nmarks\nUnion[str, 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\n\n\n\n\nType\nDescription\n\n\n\n\nGT\nResult of the table operation." + "text": "GT.opt_align_table_header(align='center')\nOption to align the table header.\nBy default, a table header added to a gt table has center alignment for both the title and the subtitle elements. This function allows us to easily set the horizontal alignment of the title and subtitle to the left or right by using the \"align\" argument. This function serves as a convenient shortcut for gt.tab_options(heading.align = <align>).\n\n\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\n\n\n\n\nType\nDescription\n\n\n\n\nGT\nResult of the table operation." }, { - "objectID": "reference/GT.opt_footnote_marks.html#parameters", - "href": "reference/GT.opt_footnote_marks.html#parameters", - "title": "GT.opt_footnote_marks", + "objectID": "reference/GT.opt_align_table_header.html#parameters", + "href": "reference/GT.opt_align_table_header.html#parameters", + "title": "GT.opt_align_table_header", "section": "", - "text": "Name\nType\nDescription\nDefault\n\n\n\n\nmarks\nUnion[str, 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'" + "text": "Name\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'" }, { - "objectID": "reference/GT.opt_footnote_marks.html#returns", - "href": "reference/GT.opt_footnote_marks.html#returns", - "title": "GT.opt_footnote_marks", + "objectID": "reference/GT.opt_align_table_header.html#returns", + "href": "reference/GT.opt_align_table_header.html#returns", + "title": "GT.opt_align_table_header", "section": "", "text": "Type\nDescription\n\n\n\n\nGT\nResult of the table operation." }, { - "objectID": "reference/GT.tab_source_note.html", - "href": "reference/GT.tab_source_note.html", - "title": "GT.tab_source_note", + "objectID": "reference/GT.fmt_integer.html", + "href": "reference/GT.fmt_integer.html", + "title": "GT.fmt_integer", "section": "", - "text": "GT.tab_source_note(source_note)\nAdd a source note citation.\nAdd a source note to the footer part of the gt table. A source note is useful for citing the data included in the table. Several can be added to the footer, simply use multiple calls of tab_source_note() 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\n\n\n\n\n\n\n\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\nsource_note\nstr\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\n\n\n\n\nType\nDescription\n\n\n\n\nGT\nResult of the table operation.\n\n\n\n\n\n\n>>> from gt import *\n>>> x = GT([{\"a\": 5, \"b\": 10}, {\"a\": 15, \"b\": 20}])\n>>> .tab_source_note(source_note=\"Source note for the table.\")\n>>> x\n>>> print(x)" + "text": "GT.fmt_integer\nFormat values as integers.\nWith numeric values in a gt table, 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\n\ncolumns : Union[str, List[str], None], optional The columns to target. Can either be a single column name or a series of column names provided in a list.\nrows : Union[int, List[int], None], optional In 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.\nscale_by : float, optional All 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.\n\n\n\nGTData The GTData object is returned." }, { - "objectID": "reference/GT.tab_source_note.html#parameters", - "href": "reference/GT.tab_source_note.html#parameters", - "title": "GT.tab_source_note", + "objectID": "reference/GT.fmt_integer.html#parameters", + "href": "reference/GT.fmt_integer.html#parameters", + "title": "GT.fmt_integer", "section": "", - "text": "Name\nType\nDescription\nDefault\n\n\n\n\nsource_note\nstr\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" + "text": "columns : Union[str, List[str], None], optional The columns to target. Can either be a single column name or a series of column names provided in a list.\nrows : Union[int, List[int], None], optional In 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.\nscale_by : float, optional All 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." }, { - "objectID": "reference/GT.tab_source_note.html#returns", - "href": "reference/GT.tab_source_note.html#returns", - "title": "GT.tab_source_note", + "objectID": "reference/GT.fmt_integer.html#returns", + "href": "reference/GT.fmt_integer.html#returns", + "title": "GT.fmt_integer", "section": "", - "text": "Type\nDescription\n\n\n\n\nGT\nResult of the table operation." + "text": "GTData The GTData object is returned." }, { - "objectID": "reference/GT.tab_source_note.html#examples", - "href": "reference/GT.tab_source_note.html#examples", - "title": "GT.tab_source_note", + "objectID": "reference/data.countrypops.html", + "href": "reference/data.countrypops.html", + "title": "data.countrypops", "section": "", - "text": ">>> from gt import *\n>>> x = GT([{\"a\": 5, \"b\": 10}, {\"a\": 15, \"b\": 20}])\n>>> .tab_source_note(source_note=\"Source note for the table.\")\n>>> x\n>>> print(x)" + "text": "data.countrypops\ndata.countrypops\nYearly populations of countries from 1960 to 2022\nA dataset that presents yearly, total populations of countries. Total population is based on counts of all residents regardless of legal status or citizenship. Country identifiers include the English-language country names, and the 2- and 3-letter ISO 3166-1 country codes. Each row contains a population value for a given year (from 1960 to 2022). Any missing values for populations indicate the non-existence of the entity during that year." }, { - "objectID": "reference/px.html", - "href": "reference/px.html", - "title": "px", + "objectID": "reference/html.html", + "href": "reference/html.html", + "title": "html", "section": "", - "text": "px(x)\nHelper for providing a CSS length value in pixels.\nFor certain parameters, a length value is required. Examples include the setting of font sizes (e.g., in cell_text()) and thicknesses of lines (e.g., in cell_borders()). Setting a length in pixels with px() allows for an absolute definition of size as opposed to the analogous helper function pct().\n\n\n\n\n\n\n\n\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\nx\nUnion[int, float]\nThe integer or float value to format as a string (e.g., \"12px\") for some tab_options() arguments that can take values as units of pixels (e.g., table_font_size).\nrequired\n\n\n\n\n\n\n>>> from gt import *\n>>> x = gt.px(12)\n>>> x\n>>> print(x)" + "text": "html\nhtml(text)\nInterpret input text as HTML-formatted text.\nFor certain pieces of text (like in column labels or table headings) we may want to express them as raw HTML. In fact, with HTML, anything goes so it can be much more than just text. The html() function will guard the input HTML against escaping, so, your HTML tags will come through as HTML when rendered… to HTML.\nArgs: text (str): The text that is understood to contain HTML formatting.\nReturns: Text: An instance of the Text class is returned, where the text type is ‘html’." }, { - "objectID": "reference/px.html#parameters", - "href": "reference/px.html#parameters", - "title": "px", + "objectID": "reference/data.sp500.html", + "href": "reference/data.sp500.html", + "title": "data.sp500", "section": "", - "text": "Name\nType\nDescription\nDefault\n\n\n\n\nx\nUnion[int, float]\nThe integer or float value to format as a string (e.g., \"12px\") for some tab_options() arguments that can take values as units of pixels (e.g., table_font_size).\nrequired" + "text": "data.sp500\ndata.sp500\nDaily S&P 500 Index data from 1950 to 2015\nThis dataset provides daily price indicators for the S&P 500 index from the beginning of 1950 to the end of 2015. The index includes 500 leading companies and captures about 80 percent coverage of available market capitalization." }, { - "objectID": "reference/px.html#examples", - "href": "reference/px.html#examples", - "title": "px", + "objectID": "reference/data.pizzaplace.html", + "href": "reference/data.pizzaplace.html", + "title": "data.pizzaplace", "section": "", - "text": ">>> from gt import *\n>>> x = gt.px(12)\n>>> x\n>>> print(x)" + "text": "data.pizzaplace\ndata.pizzaplace\nA year of pizza sales from a pizza place\nA synthetic dataset that describes pizza sales for a pizza place somewhere in the US. While the contents are artificial, the ingredients used to make the pizzas are far from it. There are 32 different pizzas that fall into 4 different categories: classic (classic pizzas: ‘You probably had one like it before, but never like this!’), chicken (pizzas with chicken as a major ingredient: ‘Try the Southwest Chicken Pizza! You’ll love it!’), supreme (pizzas that try a little harder: ‘My Soppressata pizza uses only the finest salami from my personal salumist!’), and, veggie (pizzas without any meats whatsoever: ‘My Five Cheese pizza has so many cheeses, I can only offer it in Large Size!’)." }, { - "objectID": "reference/GT.opt_align_table_header.html", - "href": "reference/GT.opt_align_table_header.html", - "title": "GT.opt_align_table_header", + "objectID": "reference/GT.fmt.html", + "href": "reference/GT.fmt.html", + "title": "GT.fmt", "section": "", - "text": "GT.opt_align_table_header(align='center')\nOption to align the table header.\nBy default, a table header added to a gt table has center alignment for both the title and the subtitle elements. This function allows us to easily set the horizontal alignment of the title and subtitle to the left or right by using the \"align\" argument. This function serves as a convenient shortcut for gt.tab_options(heading.align = <align>).\n\n\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\n\n\n\n\nType\nDescription\n\n\n\n\nGT\nResult of the table operation." + "text": "GT.fmt(x, fns, columns=None, rows=None)\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\n\n\n\n\n\n\n\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\nfns\nUnion[FormatFn, FormatFns]\nEither a single formatting function or a named list of functions.\nrequired\n\n\ncolumns\nUnion[str, List[str], 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\nUnion[int, 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\n\n\n\n\n\n\n\nType\nDescription\n\n\n\n\nGTData\nThe GTData object is returned." }, { - "objectID": "reference/GT.opt_align_table_header.html#parameters", - "href": "reference/GT.opt_align_table_header.html#parameters", - "title": "GT.opt_align_table_header", + "objectID": "reference/GT.fmt.html#parameters", + "href": "reference/GT.fmt.html#parameters", + "title": "GT.fmt", "section": "", - "text": "Name\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'" + "text": "Name\nType\nDescription\nDefault\n\n\n\n\nfns\nUnion[FormatFn, FormatFns]\nEither a single formatting function or a named list of functions.\nrequired\n\n\ncolumns\nUnion[str, List[str], 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\nUnion[int, 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" }, { - "objectID": "reference/GT.opt_align_table_header.html#returns", - "href": "reference/GT.opt_align_table_header.html#returns", - "title": "GT.opt_align_table_header", + "objectID": "reference/GT.fmt.html#returns", + "href": "reference/GT.fmt.html#returns", + "title": "GT.fmt", "section": "", - "text": "Type\nDescription\n\n\n\n\nGT\nResult of the table operation." + "text": "Type\nDescription\n\n\n\n\nGTData\nThe GTData object is returned." }, { - "objectID": "reference/GT.html", - "href": "reference/GT.html", - "title": "GT", + "objectID": "reference/data.sza.html", + "href": "reference/data.sza.html", + "title": "data.sza", "section": "", - "text": "GT(self, data, locale='', **kwargs)\nCreate a gt Table object.\n\n\nrender: Renders and returns the HTML table.\n\n\n\n>>> from gt import *\n>>> x = GT([{\"a\": 5, \"b\": 10}, {\"a\": 15, \"b\": 20}])\n>>> x\n>>> print(x)\n\n\n\n\n\n\nName\nDescription\n\n\n\n\nfmt_integer\nFormat values as integers.\n\n\nfmt_number\nFormat numeric values." + "text": "data.sza\ndata.sza\nTwice hourly solar zenith angles by month & latitude\nThis dataset contains solar zenith angles (in degrees, with the range of 0-90) every half hour from 04:00 to 12:00, true solar time. This set of values is calculated on the first of every month for 4 different northern hemisphere latitudes. For determination of afternoon values, the presented tabulated values are symmetric about noon." }, { - "objectID": "reference/GT.html#methods", - "href": "reference/GT.html#methods", - "title": "GT", + "objectID": "reference/GT.fmt_scientific.html", + "href": "reference/GT.fmt_scientific.html", + "title": "GT.fmt_scientific", "section": "", - "text": "render: Renders and returns the HTML table." + "text": "GT.fmt_scientific\nGT.fmt_scientific(columns=None, rows=None)" }, { - "objectID": "reference/GT.html#examples", - "href": "reference/GT.html#examples", - "title": "GT", + "objectID": "reference/px.html", + "href": "reference/px.html", + "title": "px", "section": "", - "text": ">>> from gt import *\n>>> x = GT([{\"a\": 5, \"b\": 10}, {\"a\": 15, \"b\": 20}])\n>>> x\n>>> print(x)" + "text": "px(x)\nHelper for providing a CSS length value in pixels.\nFor certain parameters, a length value is required. Examples include the setting of font sizes (e.g., in cell_text()) and thicknesses of lines (e.g., in cell_borders()). Setting a length in pixels with px() allows for an absolute definition of size as opposed to the analogous helper function pct().\n\n\n\n\n\n\n\n\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\nx\nUnion[int, float]\nThe integer or float value to format as a string (e.g., \"12px\") for some tab_options() arguments that can take values as units of pixels (e.g., table_font_size).\nrequired\n\n\n\n\n\n\n>>> from gt import *\n>>> x = gt.px(12)\n>>> x\n>>> print(x)" }, { - "objectID": "reference/GT.html#attributes", - "href": "reference/GT.html#attributes", - "title": "GT", + "objectID": "reference/px.html#parameters", + "href": "reference/px.html#parameters", + "title": "px", "section": "", - "text": "Name\nDescription\n\n\n\n\nfmt_integer\nFormat values as integers.\n\n\nfmt_number\nFormat numeric values." + "text": "Name\nType\nDescription\nDefault\n\n\n\n\nx\nUnion[int, float]\nThe integer or float value to format as a string (e.g., \"12px\") for some tab_options() arguments that can take values as units of pixels (e.g., table_font_size).\nrequired" }, { - "objectID": "reference/GT.fmt_scientific.html", - "href": "reference/GT.fmt_scientific.html", - "title": "GT.fmt_scientific", + "objectID": "reference/px.html#examples", + "href": "reference/px.html#examples", + "title": "px", "section": "", - "text": "GT.fmt_scientific\nGT.fmt_scientific(columns=None, rows=None)" + "text": ">>> from gt import *\n>>> x = gt.px(12)\n>>> x\n>>> print(x)" }, { "objectID": "reference/index.html", @@ -426,6 +363,27 @@ "section": "", "text": "data.countrypops\nYearly populations of countries from 1960 to 2022\n\n\ndata.sza\nTwice hourly solar zenith angles by month & latitude\n\n\ndata.gtcars\nDeluxe automobiles from the 2014-2017 period\n\n\ndata.sp500\nDaily S&P 500 Index data from 1950 to 2015\n\n\ndata.pizzaplace\nA year of pizza sales from a pizza place\n\n\ndata.exibble\nA toy example table for testing with gt: exibble" }, + { + "objectID": "reference/GT.opt_row_striping.html", + "href": "reference/GT.opt_row_striping.html", + "title": "GT.opt_row_striping", + "section": "", + "text": "GT.opt_row_striping(row_striping=True)\nOption to add or remove row striping.\nBy default, a gt*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 gt.tab_options(row_striping_include_table_body = <True|False>).\n\n\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\n\n\n\n\nType\nDescription\n\n\n\n\nGT\nResult of the table operation." + }, + { + "objectID": "reference/GT.opt_row_striping.html#parameters", + "href": "reference/GT.opt_row_striping.html#parameters", + "title": "GT.opt_row_striping", + "section": "", + "text": "Name\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" + }, + { + "objectID": "reference/GT.opt_row_striping.html#returns", + "href": "reference/GT.opt_row_striping.html#returns", + "title": "GT.opt_row_striping", + "section": "", + "text": "Type\nDescription\n\n\n\n\nGT\nResult of the table operation." + }, { "objectID": "reference/GT.fmt_engineering.html", "href": "reference/GT.fmt_engineering.html", @@ -434,18 +392,74 @@ "text": "GT.fmt_engineering\nGT.fmt_engineering(columns=None, rows=None)" }, { - "objectID": "reference/data.pizzaplace.html", - "href": "reference/data.pizzaplace.html", - "title": "data.pizzaplace", + "objectID": "reference/pct.html", + "href": "reference/pct.html", + "title": "pct", "section": "", - "text": "data.pizzaplace\ndata.pizzaplace\nA year of pizza sales from a pizza place\nA synthetic dataset that describes pizza sales for a pizza place somewhere in the US. While the contents are artificial, the ingredients used to make the pizzas are far from it. There are 32 different pizzas that fall into 4 different categories: classic (classic pizzas: ‘You probably had one like it before, but never like this!’), chicken (pizzas with chicken as a major ingredient: ‘Try the Southwest Chicken Pizza! You’ll love it!’), supreme (pizzas that try a little harder: ‘My Soppressata pizza uses only the finest salami from my personal salumist!’), and, veggie (pizzas without any meats whatsoever: ‘My Five Cheese pizza has so many cheeses, I can only offer it in Large Size!’)." + "text": "pct(x)\nHelper for providing a CSS length value as a percentage.\nA percentage value acts as a length value that is relative to an initial state. For instance an 80% value for something will size the target to 80% the size of its ‘previous’ value. This type of sizing is useful for sizing up or down a length value with an intuitive measure. This helper function can be used for the setting of font sizes (e.g., in cell_text()) and altering the thicknesses of lines (e.g., in cell_borders(). Should a more exact definition of size be required, the analogous helper function pct() will be more useful.\n\n\n\n\n\n\n\n\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\nx\nUnion[int, float]\nThe integer or float value to format as a string-based percentage value for some tab_options() arguments that can take percentage values (e.g., table.width).\nrequired\n\n\n\n\n\n\n>>> from gt import *\n>>> x = gt.pct(80)\n>>> x\n>>> print(x)" }, { - "objectID": "reference/data.countrypops.html", - "href": "reference/data.countrypops.html", - "title": "data.countrypops", + "objectID": "reference/pct.html#parameters", + "href": "reference/pct.html#parameters", + "title": "pct", "section": "", - "text": "data.countrypops\ndata.countrypops\nYearly populations of countries from 1960 to 2022\nA dataset that presents yearly, total populations of countries. Total population is based on counts of all residents regardless of legal status or citizenship. Country identifiers include the English-language country names, and the 2- and 3-letter ISO 3166-1 country codes. Each row contains a population value for a given year (from 1960 to 2022). Any missing values for populations indicate the non-existence of the entity during that year." + "text": "Name\nType\nDescription\nDefault\n\n\n\n\nx\nUnion[int, float]\nThe integer or float value to format as a string-based percentage value for some tab_options() arguments that can take percentage values (e.g., table.width).\nrequired" + }, + { + "objectID": "reference/pct.html#examples", + "href": "reference/pct.html#examples", + "title": "pct", + "section": "", + "text": ">>> from gt import *\n>>> x = gt.pct(80)\n>>> x\n>>> print(x)" + }, + { + "objectID": "reference/GT.fmt_percent.html", + "href": "reference/GT.fmt_percent.html", + "title": "GT.fmt_percent", + "section": "", + "text": "GT.fmt_percent\nGT.fmt_percent(columns=None, rows=None, decimals=2, drop_trailing_zeros=False, drop_trailing_dec_mark=True)" + }, + { + "objectID": "reference/GT.opt_all_caps.html", + "href": "reference/GT.opt_all_caps.html", + "title": "GT.opt_all_caps", + "section": "", + "text": "GT.opt_all_caps(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 function serves as a convenient shortcut for tab_options(<location>.text_transform=\"uppercase\", <location>.font.size=gt.pct(80), <location>.font.weight=\"bolder\") (for all locations selected).\n\n\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\nUnion[str, 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\n\n\n\n\nType\nDescription\n\n\n\n\nGT\nResult of the table operation." + }, + { + "objectID": "reference/GT.opt_all_caps.html#parameters", + "href": "reference/GT.opt_all_caps.html#parameters", + "title": "GT.opt_all_caps", + "section": "", + "text": "Name\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\nUnion[str, 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']" + }, + { + "objectID": "reference/GT.opt_all_caps.html#returns", + "href": "reference/GT.opt_all_caps.html#returns", + "title": "GT.opt_all_caps", + "section": "", + "text": "Type\nDescription\n\n\n\n\nGT\nResult of the table operation." + }, + { + "objectID": "reference/GT.opt_footnote_marks.html", + "href": "reference/GT.opt_footnote_marks.html", + "title": "GT.opt_footnote_marks", + "section": "", + "text": "GT.opt_footnote_marks(marks='numbers')\nOption to modify the set of footnote marks.\nAlter 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 function 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\n\n\n\n\n\n\n\n\n\n\nName\nType\nDescription\nDefault\n\n\n\n\nmarks\nUnion[str, 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\n\n\n\n\nType\nDescription\n\n\n\n\nGT\nResult of the table operation." + }, + { + "objectID": "reference/GT.opt_footnote_marks.html#parameters", + "href": "reference/GT.opt_footnote_marks.html#parameters", + "title": "GT.opt_footnote_marks", + "section": "", + "text": "Name\nType\nDescription\nDefault\n\n\n\n\nmarks\nUnion[str, 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'" + }, + { + "objectID": "reference/GT.opt_footnote_marks.html#returns", + "href": "reference/GT.opt_footnote_marks.html#returns", + "title": "GT.opt_footnote_marks", + "section": "", + "text": "Type\nDescription\n\n\n\n\nGT\nResult of the table operation." }, { "objectID": "reference/GT.tab_header.html", @@ -476,31 +490,17 @@ "text": ">>> from gt import *\n>>> x = GT([{\"a\": 5, \"b\": 10}, {\"a\": 15, \"b\": 20}])\n>>> .tab_header(title=\"Title\", subtitle=\"Subtitle\")\n>>> x\n>>> print(x)" }, { - "objectID": "reference/data.sp500.html", - "href": "reference/data.sp500.html", - "title": "data.sp500", - "section": "", - "text": "data.sp500\ndata.sp500\nDaily S&P 500 Index data from 1950 to 2015\nThis dataset provides daily price indicators for the S&P 500 index from the beginning of 1950 to the end of 2015. The index includes 500 leading companies and captures about 80 percent coverage of available market capitalization." - }, - { - "objectID": "reference/GT.opt_row_striping.html", - "href": "reference/GT.opt_row_striping.html", - "title": "GT.opt_row_striping", - "section": "", - "text": "GT.opt_row_striping(row_striping=True)\nOption to add or remove row striping.\nBy default, a gt*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 gt.tab_options(row_striping_include_table_body = <True|False>).\n\n\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\n\n\n\n\nType\nDescription\n\n\n\n\nGT\nResult of the table operation." - }, - { - "objectID": "reference/GT.opt_row_striping.html#parameters", - "href": "reference/GT.opt_row_striping.html#parameters", - "title": "GT.opt_row_striping", + "objectID": "examples-qmd/table-manipulation.html", + "href": "examples-qmd/table-manipulation.html", + "title": "great_tables", "section": "", - "text": "Name\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" + "text": "import great_tables as gt\nfrom great_tables import exibble, countrypops, gtcars # , md, html\n\nfrom siuba import *\n\n\nres = gtcars >> select(_.mfr, _.model, _.msrp) >> _.head(5)\n# TODO: Make `md()` work\ngt.GT(res).tab_header(\n title=\"Data listing from **gtcars**\", subtitle=\"`gtcars` is an R dataset\"\n).fmt_number(columns=\"msrp\", decimals=2, scale_by=1 / 10000)\n\nTypeError: Invalid value '44.70' for dtype Int64\n\n\nGT(_tbl_data= mfr model msrp\n0 Ford GT 447000\n1 Ferrari 458 Speciale 291744\n2 Ferrari 458 Spider 263553\n3 Ferrari 458 Italia 233509\n4 Ferrari 488 GTB 245400, _body=<great_tables._gt_data.Body object at 0x7f124e62d090>, _boxhead=Boxhead([<great_tables._gt_data.ColInfo object at 0x7f124e62c520>, <great_tables._gt_data.ColInfo object at 0x7f124e62ca90>, <great_tables._gt_data.ColInfo object at 0x7f124e62c250>]), _stub=Stub([RowInfo(rownum_i=0, group_id=None, rowname=None, group_label=None, built=False), RowInfo(rownum_i=1, group_id=None, rowname=None, group_label=None, built=False), RowInfo(rownum_i=2, group_id=None, rowname=None, group_label=None, built=False), RowInfo(rownum_i=3, group_id=None, rowname=None, group_label=None, built=False), RowInfo(rownum_i=4, group_id=None, rowname=None, group_label=None, built=False)]), _row_groups=RowGroups([]), _spanners=<great_tables._gt_data.Spanners object at 0x7f124e62d0f0>, _heading=<great_tables._gt_data.Heading object at 0x7f124e62d240>, _stubhead=<great_tables._gt_data.Stubhead object at 0x7f124e62c3d0>, _source_notes=<great_tables._gt_data.SourceNotes object at 0x7f124e62d0c0>, _footnotes=<great_tables._gt_data.Footnotes object at 0x7f124e62d360>, _styles=<great_tables._gt_data.Styles object at 0x7f124e62d5a0>, _locale=<great_tables._gt_data.Locale object at 0x7f124e62d5d0>, _formats=[<great_tables._gt_data.FormatInfo object at 0x7f124e645480>], _options=<great_tables._gt_data.Options object at 0x7f124e62d570>, _has_built=False)\n\n\n\ngt.GT(exibble.iloc[[4, 3, 7, 1],], groupname_col=\"group\")\n\n\n\n\n\n\n\n\nnum\nchar\nfctr\ndate\ntime\ndatetime\ncurrency\nrow\ngroup\n\n\n\n\n5550.0\nnan\nfive\n2015-05-15\n17:55\n2018-05-05 04:00\n1325.81\nrow_5\ngrp_b\n\n\n8880000.0\nhoneydew\neight\n2015-08-15\n20:20\nnan\n0.44\nrow_8\ngrp_b\n\n\n444.4\ndurian\nfour\n2015-04-15\n16:50\n2018-04-04 15:55\n65100.0\nrow_4\ngrp_a\n\n\n2.222\nbanana\ntwo\n2015-02-15\n14:40\n2018-02-02 14:33\n17.95\nrow_2\ngrp_a\n\n\n\n\n\n\n \n\n\n\nres = gtcars >> select(_.mfr, _.model, _.msrp) >> _.head(5)\n\n# TODO: Make `html()` work\ngt.GT(res).tab_header(\n title=html(\"Data listing from <strong>gtcars</strong>\"),\n subtitle=html(\"From <span style='color:red;'>gtcars</span>\"),\n)" }, { - "objectID": "reference/GT.opt_row_striping.html#returns", - "href": "reference/GT.opt_row_striping.html#returns", - "title": "GT.opt_row_striping", + "objectID": "examples-qmd/tab-spanner.html", + "href": "examples-qmd/tab-spanner.html", + "title": "great_tables", "section": "", - "text": "Type\nDescription\n\n\n\n\nGT\nResult of the table operation." + "text": "from siuba import *\nimport great_tables as gt\n\n\ndf = (\n gt.gtcars\n >> select(~_.mfr, ~_.trim, _.bdy_style, ~_.drivetrain, ~_.trsmn, ~_.ctry_origin)\n >> head(n = 10)\n)\n\n\n(gt.GT(df, rowname_col = \"model\")\n .tab_spanner(\n label = \"performance\",\n columns = [\"hp\", \"hp_rpm\", \"trq\", \"trq_rpm\", \"mpg_c\", \"mpg_h\"]\n )\n)\n\n\ndf2 = (\n gt.towny\n >> arrange(-_.population_2021)\n >> head(n = 5)\n >> select(_.name, _.latitude, _.longitude, _.endswith(\"2016\"), _.endswith(\"2021\"))\n)\n\n(gt.GT(df2)\n .tab_spanner(label = \"Population\", columns=_.startswith(\"pop\"))\n .tab_spanner(label = \"Density\", columns = _.startswith(\"den\"))\n .tab_spanner(label = gt.md(\"*Location*\"), columns = _.endswith(\"itude\"), id=\"loc\")\n)\n\n\nexibble_narrow = gt.exibble >> head(n = 3)\n\n\n(gt.GT(exibble_narrow)\n .tab_spanner(label = \"Row Information\", columns = _[\"row\", \"group\"])\n # TODO: tidyselect numeric columns\n .tab_spanner(label = \"Numeric Values\", columns = [\"num\", \"currency\"], id = \"num_spanner\")\n .tab_spanner(label = \"Text Values\", columns = [\"char\", \"fctr\"], id = \"text_spanner\")\n .tab_spanner(label = \"Numbers and Text\", spanners = [\"num_spanner\", \"text_spanner\"])\n)\n\n\nexibble_narrow_gt = (gt.GT(exibble_narrow)\n .tab_spanner(label = \"Numeric Values\", columns = [\"num\", \"currency\"], id = \"num_spanner\")\n .tab_spanner(label = \"Text Values\", columns = (\"char\", \"fctr\"), id = \"text_spanner\")\n .tab_spanner(\n label = \"Text, Dates, Times, Datetimes\",\n # TODO: what is the RE flag name?\n columns = _.contains(\"date|time\", re = True),\n spanners = \"text_spanner\"\n )\n)\n\nexibble_narrow_gt\n\n\n(exibble_narrow_gt\n .tab_spanner(\n label = \"Date and Time Columns\",\n columns = _.contains(\"date|time\"),\n id = \"date_time_spanner\"\n )\n)\n\n\n(exibble_narrow_gt\n .tab_spanner(\n label = \"Date and Time Columns\",\n columns = _.contains(\"date|time\"),\n level = 1,\n id = \"date_time_spanner\"\n )\n)\n\n\nlil_towny = (gt.towny\n >> select(\n _.name, _.endswith(\"2001\"), _.endswith(\"2006\"), _.contains(\"2001_2006\")\n )\n >> filter(_.population_2001 > 100000)\n >> arrange(-_.pop_change_2001_2006_pct)\n >> head(n = 10)\n)\n\n(gt.GT(lil_towny)\n .fmt_integer() |>\n .fmt_percent(columns = _.contains(\"change\"), decimals = 1)\n .tab_spanner(\n label = \"Population\",\n columns = _.startswith(\"population\")\n )\n .tab_spanner(\n label = \"Density, {{*persons* km^-2}}\",\n columns = _.startswith(\"density\")\n )\n .cols_label(\n {\n _.endswith(\"01\"): \"2001\",\n _.endswith(\"06\"): \"2006\",\n _.contains(\"change\"): md(\"Population Change,<br>2001 to 2006\")\n }\n )\n .cols_width(\n {_.everything(): px(120)}\n # Alternatively, we could do this syntax:\n # _.everything().label(px(120))\n )\n)" } ] \ No newline at end of file