diff --git a/examples-qmd/fmt-number.html b/examples-qmd/fmt-number.html index bf3bbe2b3..c1dacc64d 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 0x7f24fd6efa30>, _boxhead=Boxhead([<great_tables._gt_data.ColInfo object at 0x7f24fd7973a0>, <great_tables._gt_data.ColInfo object at 0x7f24fd797400>, <great_tables._gt_data.ColInfo object at 0x7f24fd797760>, <great_tables._gt_data.ColInfo object at 0x7f24fd7968f0>, <great_tables._gt_data.ColInfo object at 0x7f24fd796d70>, <great_tables._gt_data.ColInfo object at 0x7f24fd796980>, <great_tables._gt_data.ColInfo object at 0x7f24fd797460>, <great_tables._gt_data.ColInfo object at 0x7f24fd797250>, <great_tables._gt_data.ColInfo object at 0x7f24fd797d30>, <great_tables._gt_data.ColInfo object at 0x7f24fd7969e0>]), _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 0x7f24fd797190>, _heading=<great_tables._gt_data.Heading object at 0x7f24fd7968c0>, _stubhead=<great_tables._gt_data.Stubhead object at 0x7f24fd7971c0>, _source_notes=<great_tables._gt_data.SourceNotes object at 0x7f24fd796f50>, _footnotes=<great_tables._gt_data.Footnotes object at 0x7f24fd796dd0>, _styles=<great_tables._gt_data.Styles object at 0x7f24fd797d00>, _locale=<great_tables._gt_data.Locale object at 0x7f24fd797d90>, _formats=[<great_tables._gt_data.FormatInfo object at 0x7f24fd5d8190>, <great_tables._gt_data.FormatInfo object at 0x7f24fd5d8310>], _options=<great_tables._gt_data.Options object at 0x7f24fd797c10>, _has_built=False) +3 174372098 194454498 210969298 227196741 , _body=<great_tables._gt_data.Body object at 0x7f8258bebbe0>, _boxhead=Boxhead([<great_tables._gt_data.ColInfo object at 0x7f8258c97340>, <great_tables._gt_data.ColInfo object at 0x7f8258c973a0>, <great_tables._gt_data.ColInfo object at 0x7f8258c97700>, <great_tables._gt_data.ColInfo object at 0x7f8258c96890>, <great_tables._gt_data.ColInfo object at 0x7f8258c96d10>, <great_tables._gt_data.ColInfo object at 0x7f8258c96920>, <great_tables._gt_data.ColInfo object at 0x7f8258c97400>, <great_tables._gt_data.ColInfo object at 0x7f8258c971f0>, <great_tables._gt_data.ColInfo object at 0x7f8258c97cd0>, <great_tables._gt_data.ColInfo object at 0x7f8258c96980>]), _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 0x7f8258c97130>, _heading=<great_tables._gt_data.Heading object at 0x7f8258c96860>, _stubhead=<great_tables._gt_data.Stubhead object at 0x7f8258c97160>, _source_notes=<great_tables._gt_data.SourceNotes object at 0x7f8258c96ef0>, _footnotes=<great_tables._gt_data.Footnotes object at 0x7f8258c96d70>, _styles=<great_tables._gt_data.Styles object at 0x7f8258c97ca0>, _locale=<great_tables._gt_data.Locale object at 0x7f8258c97d30>, _formats=[<great_tables._gt_data.FormatInfo object at 0x7f8258ad8130>, <great_tables._gt_data.FormatInfo object at 0x7f8258ad82b0>], _options=<great_tables._gt_data.Options object at 0x7f8258c97bb0>, _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 6a5f252d2..e4215a67c 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 0x7f1424c41000>, _boxhead=Boxhead([<great_tables._gt_data.ColInfo object at 0x7f1424c40a90>, <great_tables._gt_data.ColInfo object at 0x7f1424c40a60>, <great_tables._gt_data.ColInfo object at 0x7f1424c401f0>]), _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 0x7f1424c41060>, _heading=<great_tables._gt_data.Heading object at 0x7f1424c411b0>, _stubhead=<great_tables._gt_data.Stubhead object at 0x7f1424c40370>, _source_notes=<great_tables._gt_data.SourceNotes object at 0x7f1424c41030>, _footnotes=<great_tables._gt_data.Footnotes object at 0x7f1424c412d0>, _styles=<great_tables._gt_data.Styles object at 0x7f1424c41510>, _locale=<great_tables._gt_data.Locale object at 0x7f1424c41540>, _formats=[<great_tables._gt_data.FormatInfo object at 0x7f1424c59420>], _options=<great_tables._gt_data.Options object at 0x7f1424c414e0>, _has_built=False) +4 Ferrari 488 GTB 245400, _body=<great_tables._gt_data.Body object at 0x7f2e88c44fd0>, _boxhead=Boxhead([<great_tables._gt_data.ColInfo object at 0x7f2e88c443a0>, <great_tables._gt_data.ColInfo object at 0x7f2e88c44a30>, <great_tables._gt_data.ColInfo object at 0x7f2e88c441c0>]), _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 0x7f2e88c45030>, _heading=<great_tables._gt_data.Heading object at 0x7f2e88c45180>, _stubhead=<great_tables._gt_data.Stubhead object at 0x7f2e88c44310>, _source_notes=<great_tables._gt_data.SourceNotes object at 0x7f2e88c45000>, _footnotes=<great_tables._gt_data.Footnotes object at 0x7f2e88c452a0>, _styles=<great_tables._gt_data.Styles object at 0x7f2e88c454e0>, _locale=<great_tables._gt_data.Locale object at 0x7f2e88c45510>, _formats=[<great_tables._gt_data.FormatInfo object at 0x7f2e88c5d3f0>], _options=<great_tables._gt_data.Options object at 0x7f2e88c454b0>, _has_built=False)
diff --git a/search.json b/search.json index 2f7e302d1..86b20db3f 100644 --- a/search.json +++ b/search.json @@ -11,7 +11,7 @@ "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 0x7f24fd6efa30>, _boxhead=Boxhead([<great_tables._gt_data.ColInfo object at 0x7f24fd7973a0>, <great_tables._gt_data.ColInfo object at 0x7f24fd797400>, <great_tables._gt_data.ColInfo object at 0x7f24fd797760>, <great_tables._gt_data.ColInfo object at 0x7f24fd7968f0>, <great_tables._gt_data.ColInfo object at 0x7f24fd796d70>, <great_tables._gt_data.ColInfo object at 0x7f24fd796980>, <great_tables._gt_data.ColInfo object at 0x7f24fd797460>, <great_tables._gt_data.ColInfo object at 0x7f24fd797250>, <great_tables._gt_data.ColInfo object at 0x7f24fd797d30>, <great_tables._gt_data.ColInfo object at 0x7f24fd7969e0>]), _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 0x7f24fd797190>, _heading=<great_tables._gt_data.Heading object at 0x7f24fd7968c0>, _stubhead=<great_tables._gt_data.Stubhead object at 0x7f24fd7971c0>, _source_notes=<great_tables._gt_data.SourceNotes object at 0x7f24fd796f50>, _footnotes=<great_tables._gt_data.Footnotes object at 0x7f24fd796dd0>, _styles=<great_tables._gt_data.Styles object at 0x7f24fd797d00>, _locale=<great_tables._gt_data.Locale object at 0x7f24fd797d90>, _formats=[<great_tables._gt_data.FormatInfo object at 0x7f24fd5d8190>, <great_tables._gt_data.FormatInfo object at 0x7f24fd5d8310>], _options=<great_tables._gt_data.Options object at 0x7f24fd797c10>, _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/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 0x7f8258bebbe0>, _boxhead=Boxhead([<great_tables._gt_data.ColInfo object at 0x7f8258c97340>, <great_tables._gt_data.ColInfo object at 0x7f8258c973a0>, <great_tables._gt_data.ColInfo object at 0x7f8258c97700>, <great_tables._gt_data.ColInfo object at 0x7f8258c96890>, <great_tables._gt_data.ColInfo object at 0x7f8258c96d10>, <great_tables._gt_data.ColInfo object at 0x7f8258c96920>, <great_tables._gt_data.ColInfo object at 0x7f8258c97400>, <great_tables._gt_data.ColInfo object at 0x7f8258c971f0>, <great_tables._gt_data.ColInfo object at 0x7f8258c97cd0>, <great_tables._gt_data.ColInfo object at 0x7f8258c96980>]), _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 0x7f8258c97130>, _heading=<great_tables._gt_data.Heading object at 0x7f8258c96860>, _stubhead=<great_tables._gt_data.Stubhead object at 0x7f8258c97160>, _source_notes=<great_tables._gt_data.SourceNotes object at 0x7f8258c96ef0>, _footnotes=<great_tables._gt_data.Footnotes object at 0x7f8258c96d70>, _styles=<great_tables._gt_data.Styles object at 0x7f8258c97ca0>, _locale=<great_tables._gt_data.Locale object at 0x7f8258c97d30>, _formats=[<great_tables._gt_data.FormatInfo object at 0x7f8258ad8130>, <great_tables._gt_data.FormatInfo object at 0x7f8258ad82b0>], _options=<great_tables._gt_data.Options object at 0x7f8258c97bb0>, _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": "changelog.html", @@ -508,7 +508,7 @@ "href": "examples-qmd/table-manipulation.html", "title": "great_tables", "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 0x7f1424c41000>, _boxhead=Boxhead([<great_tables._gt_data.ColInfo object at 0x7f1424c40a90>, <great_tables._gt_data.ColInfo object at 0x7f1424c40a60>, <great_tables._gt_data.ColInfo object at 0x7f1424c401f0>]), _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 0x7f1424c41060>, _heading=<great_tables._gt_data.Heading object at 0x7f1424c411b0>, _stubhead=<great_tables._gt_data.Stubhead object at 0x7f1424c40370>, _source_notes=<great_tables._gt_data.SourceNotes object at 0x7f1424c41030>, _footnotes=<great_tables._gt_data.Footnotes object at 0x7f1424c412d0>, _styles=<great_tables._gt_data.Styles object at 0x7f1424c41510>, _locale=<great_tables._gt_data.Locale object at 0x7f1424c41540>, _formats=[<great_tables._gt_data.FormatInfo object at 0x7f1424c59420>], _options=<great_tables._gt_data.Options object at 0x7f1424c414e0>, _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": "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 0x7f2e88c44fd0>, _boxhead=Boxhead([<great_tables._gt_data.ColInfo object at 0x7f2e88c443a0>, <great_tables._gt_data.ColInfo object at 0x7f2e88c44a30>, <great_tables._gt_data.ColInfo object at 0x7f2e88c441c0>]), _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 0x7f2e88c45030>, _heading=<great_tables._gt_data.Heading object at 0x7f2e88c45180>, _stubhead=<great_tables._gt_data.Stubhead object at 0x7f2e88c44310>, _source_notes=<great_tables._gt_data.SourceNotes object at 0x7f2e88c45000>, _footnotes=<great_tables._gt_data.Footnotes object at 0x7f2e88c452a0>, _styles=<great_tables._gt_data.Styles object at 0x7f2e88c454e0>, _locale=<great_tables._gt_data.Locale object at 0x7f2e88c45510>, _formats=[<great_tables._gt_data.FormatInfo object at 0x7f2e88c5d3f0>], _options=<great_tables._gt_data.Options object at 0x7f2e88c454b0>, _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": "examples-qmd/tab-spanner.html",