From b8ecd75a66ae2472d7317378fac9e59ca3733bb8 Mon Sep 17 00:00:00 2001 From: rich-iannone Date: Tue, 21 Nov 2023 03:12:39 +0000 Subject: [PATCH] deploy: f7aa87835c2b6811ba8f7e4f7c83a55c132f05e3 --- articles/intro.html | 532 +++++++++++++-------------- examples-qmd/GT.html | 110 +++--- examples-qmd/fmt-number.html | 112 +++--- examples-qmd/intro-old.html | 482 ++++++++++++------------ examples-qmd/table-manipulation.html | 208 +++++------ search.json | 2 +- 6 files changed, 723 insertions(+), 723 deletions(-) diff --git a/articles/intro.html b/articles/intro.html index 9276189f0..d393d17da 100644 --- a/articles/intro.html +++ b/articles/intro.html @@ -228,15 +228,15 @@

Basic use

gt_ex
-
+
- - - - - - - - - + + + + + + + + + @@ -693,15 +693,15 @@

Formatting columns

gt_ex.fmt_number(columns="num", decimals=1, scale_by=1 / 1000, pattern="{x}K")
-
+
numcharfctrdatetimedatetimecurrencyrowgroup
numcharfctrdatetimedatetimecurrencyrowgroup
0.1111
- - - - - - - - - + + + + + + + + + @@ -1163,15 +1163,15 @@

Titles and notes

)
-
+
numcharfctrdatetimedatetimecurrencyrowgroup
numcharfctrdatetimedatetimecurrencyrowgroup
0.0K
- - - - - - - - - + + + + + + + + + @@ -2138,15 +2138,15 @@

Column spanners

)
-
+
numcharfctrdatetimedatetimecurrencyrowgroup
numcharfctrdatetimedatetimecurrencyrowgroup
0.1111
- - - - - - - - - + + + + + + + + + diff --git a/examples-qmd/fmt-number.html b/examples-qmd/fmt-number.html index de75df2aa..43dcf32e7 100644 --- a/examples-qmd/fmt-number.html +++ b/examples-qmd/fmt-number.html @@ -246,15 +246,15 @@

fmt_number

gt.GT(exibble).fmt_number(columns='num', decimals=3).cols_label(char = "character")
-
+
numcharfctrdatetimedatetimecurrencyrowgroup
numcharfctrdatetimedatetimecurrencyrowgroup
0.1111
- - - - - - - - - + + + + + + + + + @@ -759,7 +759,7 @@

fmt_number

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 0x7f2f7c467d90>, _boxhead=Boxhead([ColInfo(var='country_code_3', type=<ColInfoTypeEnum.default: 1>, column_label='country_code_3', column_align='left', column_width=None), ColInfo(var=1980, type=<ColInfoTypeEnum.default: 1>, column_label=1980, column_align='center', column_width=None), ColInfo(var=1985, type=<ColInfoTypeEnum.default: 1>, column_label=1985, column_align='center', column_width=None), ColInfo(var=1990, type=<ColInfoTypeEnum.default: 1>, column_label=1990, column_align='center', column_width=None), ColInfo(var=1995, type=<ColInfoTypeEnum.default: 1>, column_label=1995, column_align='center', column_width=None), ColInfo(var=2000, type=<ColInfoTypeEnum.default: 1>, column_label=2000, column_align='center', column_width=None), ColInfo(var=2005, type=<ColInfoTypeEnum.default: 1>, column_label=2005, column_align='center', column_width=None), ColInfo(var=2010, type=<ColInfoTypeEnum.default: 1>, column_label=2010, column_align='center', column_width=None), ColInfo(var=2015, type=<ColInfoTypeEnum.default: 1>, column_label=2015, column_align='center', column_width=None), ColInfo(var=2020, type=<ColInfoTypeEnum.default: 1>, column_label=2020, column_align='center', column_width=None)]), _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=Spanners([]), _heading=<great_tables._gt_data.Heading object at 0x7f2f7c4ac430>, _stubhead=None, _source_notes=[], _footnotes=<great_tables._gt_data.Footnotes object at 0x7f2f7c4ac460>, _styles=<great_tables._gt_data.Styles object at 0x7f2f7c4ac400>, _locale=<great_tables._gt_data.Locale object at 0x7f2f7c4aca90>, _formats=[<great_tables._gt_data.FormatInfo object at 0x7f2f7c4b4d00>, <great_tables._gt_data.FormatInfo object at 0x7f2f7c4b4e80>], _options=<great_tables._gt_data.Options object at 0x7f2f7c4acaf0>, _has_built=False) +3 174372098 194454498 210969298 227196741 , _body=<great_tables._gt_data.Body object at 0x7ff5781d7d90>, _boxhead=Boxhead([ColInfo(var='country_code_3', type=<ColInfoTypeEnum.default: 1>, column_label='country_code_3', column_align='left', column_width=None), ColInfo(var=1980, type=<ColInfoTypeEnum.default: 1>, column_label=1980, column_align='center', column_width=None), ColInfo(var=1985, type=<ColInfoTypeEnum.default: 1>, column_label=1985, column_align='center', column_width=None), ColInfo(var=1990, type=<ColInfoTypeEnum.default: 1>, column_label=1990, column_align='center', column_width=None), ColInfo(var=1995, type=<ColInfoTypeEnum.default: 1>, column_label=1995, column_align='center', column_width=None), ColInfo(var=2000, type=<ColInfoTypeEnum.default: 1>, column_label=2000, column_align='center', column_width=None), ColInfo(var=2005, type=<ColInfoTypeEnum.default: 1>, column_label=2005, column_align='center', column_width=None), ColInfo(var=2010, type=<ColInfoTypeEnum.default: 1>, column_label=2010, column_align='center', column_width=None), ColInfo(var=2015, type=<ColInfoTypeEnum.default: 1>, column_label=2015, column_align='center', column_width=None), ColInfo(var=2020, type=<ColInfoTypeEnum.default: 1>, column_label=2020, column_align='center', column_width=None)]), _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=Spanners([]), _heading=<great_tables._gt_data.Heading object at 0x7ff5696c8430>, _stubhead=None, _source_notes=[], _footnotes=<great_tables._gt_data.Footnotes object at 0x7ff5696c8460>, _styles=<great_tables._gt_data.Styles object at 0x7ff5696c8400>, _locale=<great_tables._gt_data.Locale object at 0x7ff5696c8a90>, _formats=[<great_tables._gt_data.FormatInfo object at 0x7ff5696d4d00>, <great_tables._gt_data.FormatInfo object at 0x7ff5696d4e80>], _options=<great_tables._gt_data.Options object at 0x7ff5696c8af0>, _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/intro-old.html b/examples-qmd/intro-old.html index 76e60af8c..969f80fd7 100644 --- a/examples-qmd/intro-old.html +++ b/examples-qmd/intro-old.html @@ -512,15 +512,15 @@

Original GT Intro

gt_tbl
-
+
numcharacterfctrdatetimedatetimecurrencyrowgroup
numcharacterfctrdatetimedatetimecurrencyrowgroup
0.111
- - + + @@ -1098,15 +1098,15 @@

Original GT Intro

gt_tbl2
-
+
namesize
namesize
Africa
- - - - - - - - - + + + + + + + + + diff --git a/search.json b/search.json index 706d2cfea..b3c5359d5 100644 --- a/search.json +++ b/search.json @@ -816,6 +816,6 @@ "href": "examples-qmd/fmt-number.html", "title": "fmt_number", "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\n\n\n\n\nnum\ncharacter\nfctr\ndate\ntime\ndatetime\ncurrency\nrow\ngroup\n\n\n 0.111\n apricot\n one\n 2015-01-15\n 13:35\n 2018-01-01 02:22\n 49.95\n row_1\n grp_a\n\n\n 2.222\n banana\n two\n 2015-02-15\n 14:40\n 2018-02-02 14:33\n 17.95\n row_2\n grp_a\n\n\n 33.330\n coconut\n three\n 2015-03-15\n 15:45\n 2018-03-03 03:44\n 1.39\n row_3\n grp_a\n\n\n 444.400\n durian\n four\n 2015-04-15\n 16:50\n 2018-04-04 15:55\n 65100.0\n row_4\n grp_a\n\n\n 5,550.000\n nan\n five\n 2015-05-15\n 17:55\n 2018-05-05 04:00\n 1325.81\n row_5\n grp_b\n\n\n nan\n fig\n six\n 2015-06-15\n nan\n 2018-06-06 16:11\n 13.255\n row_6\n grp_b\n\n\n 777,000.000\n grapefruit\n seven\n nan\n 19:10\n 2018-07-07 05:22\n nan\n row_7\n grp_b\n\n\n 8,880,000.000\n honeydew\n eight\n 2015-08-15\n 20:20\n nan\n 0.44\n row_8\n grp_b\n\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 '98,124' 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 0x7f2f7c467d90>, _boxhead=Boxhead([ColInfo(var='country_code_3', type=<ColInfoTypeEnum.default: 1>, column_label='country_code_3', column_align='left', column_width=None), ColInfo(var=1980, type=<ColInfoTypeEnum.default: 1>, column_label=1980, column_align='center', column_width=None), ColInfo(var=1985, type=<ColInfoTypeEnum.default: 1>, column_label=1985, column_align='center', column_width=None), ColInfo(var=1990, type=<ColInfoTypeEnum.default: 1>, column_label=1990, column_align='center', column_width=None), ColInfo(var=1995, type=<ColInfoTypeEnum.default: 1>, column_label=1995, column_align='center', column_width=None), ColInfo(var=2000, type=<ColInfoTypeEnum.default: 1>, column_label=2000, column_align='center', column_width=None), ColInfo(var=2005, type=<ColInfoTypeEnum.default: 1>, column_label=2005, column_align='center', column_width=None), ColInfo(var=2010, type=<ColInfoTypeEnum.default: 1>, column_label=2010, column_align='center', column_width=None), ColInfo(var=2015, type=<ColInfoTypeEnum.default: 1>, column_label=2015, column_align='center', column_width=None), ColInfo(var=2020, type=<ColInfoTypeEnum.default: 1>, column_label=2020, column_align='center', column_width=None)]), _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=Spanners([]), _heading=<great_tables._gt_data.Heading object at 0x7f2f7c4ac430>, _stubhead=None, _source_notes=[], _footnotes=<great_tables._gt_data.Footnotes object at 0x7f2f7c4ac460>, _styles=<great_tables._gt_data.Styles object at 0x7f2f7c4ac400>, _locale=<great_tables._gt_data.Locale object at 0x7f2f7c4aca90>, _formats=[<great_tables._gt_data.FormatInfo object at 0x7f2f7c4b4d00>, <great_tables._gt_data.FormatInfo object at 0x7f2f7c4b4e80>], _options=<great_tables._gt_data.Options object at 0x7f2f7c4acaf0>, _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 )" + "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\n\n\n\n\nnum\ncharacter\nfctr\ndate\ntime\ndatetime\ncurrency\nrow\ngroup\n\n\n 0.111\n apricot\n one\n 2015-01-15\n 13:35\n 2018-01-01 02:22\n 49.95\n row_1\n grp_a\n\n\n 2.222\n banana\n two\n 2015-02-15\n 14:40\n 2018-02-02 14:33\n 17.95\n row_2\n grp_a\n\n\n 33.330\n coconut\n three\n 2015-03-15\n 15:45\n 2018-03-03 03:44\n 1.39\n row_3\n grp_a\n\n\n 444.400\n durian\n four\n 2015-04-15\n 16:50\n 2018-04-04 15:55\n 65100.0\n row_4\n grp_a\n\n\n 5,550.000\n nan\n five\n 2015-05-15\n 17:55\n 2018-05-05 04:00\n 1325.81\n row_5\n grp_b\n\n\n nan\n fig\n six\n 2015-06-15\n nan\n 2018-06-06 16:11\n 13.255\n row_6\n grp_b\n\n\n 777,000.000\n grapefruit\n seven\n nan\n 19:10\n 2018-07-07 05:22\n nan\n row_7\n grp_b\n\n\n 8,880,000.000\n honeydew\n eight\n 2015-08-15\n 20:20\n nan\n 0.44\n row_8\n grp_b\n\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 '98,124' 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 0x7ff5781d7d90>, _boxhead=Boxhead([ColInfo(var='country_code_3', type=<ColInfoTypeEnum.default: 1>, column_label='country_code_3', column_align='left', column_width=None), ColInfo(var=1980, type=<ColInfoTypeEnum.default: 1>, column_label=1980, column_align='center', column_width=None), ColInfo(var=1985, type=<ColInfoTypeEnum.default: 1>, column_label=1985, column_align='center', column_width=None), ColInfo(var=1990, type=<ColInfoTypeEnum.default: 1>, column_label=1990, column_align='center', column_width=None), ColInfo(var=1995, type=<ColInfoTypeEnum.default: 1>, column_label=1995, column_align='center', column_width=None), ColInfo(var=2000, type=<ColInfoTypeEnum.default: 1>, column_label=2000, column_align='center', column_width=None), ColInfo(var=2005, type=<ColInfoTypeEnum.default: 1>, column_label=2005, column_align='center', column_width=None), ColInfo(var=2010, type=<ColInfoTypeEnum.default: 1>, column_label=2010, column_align='center', column_width=None), ColInfo(var=2015, type=<ColInfoTypeEnum.default: 1>, column_label=2015, column_align='center', column_width=None), ColInfo(var=2020, type=<ColInfoTypeEnum.default: 1>, column_label=2020, column_align='center', column_width=None)]), _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=Spanners([]), _heading=<great_tables._gt_data.Heading object at 0x7ff5696c8430>, _stubhead=None, _source_notes=[], _footnotes=<great_tables._gt_data.Footnotes object at 0x7ff5696c8460>, _styles=<great_tables._gt_data.Styles object at 0x7ff5696c8400>, _locale=<great_tables._gt_data.Locale object at 0x7ff5696c8a90>, _formats=[<great_tables._gt_data.FormatInfo object at 0x7ff5696d4d00>, <great_tables._gt_data.FormatInfo object at 0x7ff5696d4e80>], _options=<great_tables._gt_data.Options object at 0x7ff5696c8af0>, _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 )" } ] \ No newline at end of file
numcharfctrdatetimedatetimecurrencyrowgroup
numcharfctrdatetimedatetimecurrencyrowgroup
5550.0