Skip to content

Commit

Permalink
deploy: c454bc0
Browse files Browse the repository at this point in the history
  • Loading branch information
rich-iannone committed Nov 6, 2023
1 parent 2403c4b commit ae8b586
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 12 deletions.
2 changes: 1 addition & 1 deletion examples-qmd/fmt-number.html
Original file line number Diff line number Diff line change
Expand Up @@ -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=&lt;great_tables._gt_data.Body object at 0x7f5ae93dbfa0&gt;, _boxhead=Boxhead([&lt;great_tables._gt_data.ColInfo object at 0x7f5ae9487310&gt;, &lt;great_tables._gt_data.ColInfo object at 0x7f5ae9487370&gt;, &lt;great_tables._gt_data.ColInfo object at 0x7f5ae94876d0&gt;, &lt;great_tables._gt_data.ColInfo object at 0x7f5ae9486860&gt;, &lt;great_tables._gt_data.ColInfo object at 0x7f5ae9486ce0&gt;, &lt;great_tables._gt_data.ColInfo object at 0x7f5ae9487280&gt;, &lt;great_tables._gt_data.ColInfo object at 0x7f5ae94873d0&gt;, &lt;great_tables._gt_data.ColInfo object at 0x7f5ae94871c0&gt;, &lt;great_tables._gt_data.ColInfo object at 0x7f5ae9487ca0&gt;, &lt;great_tables._gt_data.ColInfo object at 0x7f5ae9486950&gt;]), _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=&lt;great_tables._gt_data.Spanners object at 0x7f5ae9487100&gt;, _heading=&lt;great_tables._gt_data.Heading object at 0x7f5ae9486830&gt;, _stubhead=&lt;great_tables._gt_data.Stubhead object at 0x7f5ae9487130&gt;, _source_notes=&lt;great_tables._gt_data.SourceNotes object at 0x7f5ae9486ec0&gt;, _footnotes=&lt;great_tables._gt_data.Footnotes object at 0x7f5ae9486d40&gt;, _styles=&lt;great_tables._gt_data.Styles object at 0x7f5ae9487c70&gt;, _locale=&lt;great_tables._gt_data.Locale object at 0x7f5ae9487d00&gt;, _formats=[&lt;great_tables._gt_data.FormatInfo object at 0x7f5ae92cc100&gt;, &lt;great_tables._gt_data.FormatInfo object at 0x7f5ae92cc280&gt;], _options=&lt;great_tables._gt_data.Options object at 0x7f5ae9487b80&gt;, _has_built=False)</code></pre>
3 174372098 194454498 210969298 227196741 , _body=&lt;great_tables._gt_data.Body object at 0x7f3e2021bbe0&gt;, _boxhead=Boxhead([&lt;great_tables._gt_data.ColInfo object at 0x7f3e2027f3a0&gt;, &lt;great_tables._gt_data.ColInfo object at 0x7f3e2027f400&gt;, &lt;great_tables._gt_data.ColInfo object at 0x7f3e2027f760&gt;, &lt;great_tables._gt_data.ColInfo object at 0x7f3e2027e8f0&gt;, &lt;great_tables._gt_data.ColInfo object at 0x7f3e2027ed70&gt;, &lt;great_tables._gt_data.ColInfo object at 0x7f3e2027e980&gt;, &lt;great_tables._gt_data.ColInfo object at 0x7f3e2027f460&gt;, &lt;great_tables._gt_data.ColInfo object at 0x7f3e2027f250&gt;, &lt;great_tables._gt_data.ColInfo object at 0x7f3e2027fd30&gt;, &lt;great_tables._gt_data.ColInfo object at 0x7f3e2027e9e0&gt;]), _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=&lt;great_tables._gt_data.Spanners object at 0x7f3e2027f190&gt;, _heading=&lt;great_tables._gt_data.Heading object at 0x7f3e2027e8c0&gt;, _stubhead=&lt;great_tables._gt_data.Stubhead object at 0x7f3e2027f1c0&gt;, _source_notes=&lt;great_tables._gt_data.SourceNotes object at 0x7f3e2027ef50&gt;, _footnotes=&lt;great_tables._gt_data.Footnotes object at 0x7f3e2027edd0&gt;, _styles=&lt;great_tables._gt_data.Styles object at 0x7f3e2027fd00&gt;, _locale=&lt;great_tables._gt_data.Locale object at 0x7f3e2027fd90&gt;, _formats=[&lt;great_tables._gt_data.FormatInfo object at 0x7f3e200c0190&gt;, &lt;great_tables._gt_data.FormatInfo object at 0x7f3e200c0310&gt;], _options=&lt;great_tables._gt_data.Options object at 0x7f3e2027fc10&gt;, _has_built=False)</code></pre>
</div>
</div>
<p>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, <code>n_sigfig=3</code> is a very good option.</p>
Expand Down
2 changes: 1 addition & 1 deletion examples-qmd/table-manipulation.html
Original file line number Diff line number Diff line change
Expand Up @@ -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=&lt;great_tables._gt_data.Body object at 0x7fc26c349120&gt;, _boxhead=Boxhead([&lt;great_tables._gt_data.ColInfo object at 0x7fc26c3485b0&gt;, &lt;great_tables._gt_data.ColInfo object at 0x7fc26c348a90&gt;, &lt;great_tables._gt_data.ColInfo object at 0x7fc26c3489a0&gt;]), _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=&lt;great_tables._gt_data.Spanners object at 0x7fc26c349180&gt;, _heading=&lt;great_tables._gt_data.Heading object at 0x7fc26c3492d0&gt;, _stubhead=&lt;great_tables._gt_data.Stubhead object at 0x7fc26c348490&gt;, _source_notes=&lt;great_tables._gt_data.SourceNotes object at 0x7fc26c349150&gt;, _footnotes=&lt;great_tables._gt_data.Footnotes object at 0x7fc26c3493f0&gt;, _styles=&lt;great_tables._gt_data.Styles object at 0x7fc26c349630&gt;, _locale=&lt;great_tables._gt_data.Locale object at 0x7fc26c349660&gt;, _formats=[&lt;great_tables._gt_data.FormatInfo object at 0x7fc26c361540&gt;], _options=&lt;great_tables._gt_data.Options object at 0x7fc26c349600&gt;, _has_built=False)</code></pre>
4 Ferrari 488 GTB 245400, _body=&lt;great_tables._gt_data.Body object at 0x7f70d48991b0&gt;, _boxhead=Boxhead([&lt;great_tables._gt_data.ColInfo object at 0x7f70d4898640&gt;, &lt;great_tables._gt_data.ColInfo object at 0x7f70d4898b20&gt;, &lt;great_tables._gt_data.ColInfo object at 0x7f70d4898a30&gt;]), _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=&lt;great_tables._gt_data.Spanners object at 0x7f70d4899210&gt;, _heading=&lt;great_tables._gt_data.Heading object at 0x7f70d4899360&gt;, _stubhead=&lt;great_tables._gt_data.Stubhead object at 0x7f70d4898520&gt;, _source_notes=&lt;great_tables._gt_data.SourceNotes object at 0x7f70d48991e0&gt;, _footnotes=&lt;great_tables._gt_data.Footnotes object at 0x7f70d4899480&gt;, _styles=&lt;great_tables._gt_data.Styles object at 0x7f70d48996c0&gt;, _locale=&lt;great_tables._gt_data.Locale object at 0x7f70d48996f0&gt;, _formats=[&lt;great_tables._gt_data.FormatInfo object at 0x7f70d48ad5d0&gt;], _options=&lt;great_tables._gt_data.Options object at 0x7f70d4899690&gt;, _has_built=False)</code></pre>
</div>
</div>
<div class="cell" data-execution_count="3">
Expand Down
37 changes: 35 additions & 2 deletions reference/GT.fmt_scientific.html
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,11 @@
<h2 id="toc-title">On this page</h2>

<ul>
<li><a href="#great_tables.GT.fmt_scientific" id="toc-great_tables.GT.fmt_scientific" class="nav-link active" data-scroll-target="#great_tables.GT.fmt_scientific">GT.fmt_scientific</a></li>
<li><a href="#great_tables.GT.fmt_scientific" id="toc-great_tables.GT.fmt_scientific" class="nav-link active" data-scroll-target="#great_tables.GT.fmt_scientific">GT.fmt_scientific</a>
<ul class="collapse">
<li><a href="#parameters" id="toc-parameters" class="nav-link" data-scroll-target="#parameters">Parameters</a></li>
<li><a href="#returns" id="toc-returns" class="nav-link" data-scroll-target="#returns">Returns</a></li>
</ul></li>
</ul>
</nav>
</div>
Expand All @@ -432,9 +436,38 @@ <h2 id="toc-title">On this page</h2>

<section id="great_tables.GT.fmt_scientific" class="level1">
<h1>GT.fmt_scientific</h1>
<p><code>GT.fmt_scientific(columns=None, rows=None)</code></p>
<p><code>GT.fmt_scientific</code></p>
<p>Format values to scientific notation.</p>
<p>With numeric values in a <strong>gt</strong> table, we can perform formatting so that the targeted values are rendered in scientific notation, where extremely large or very small numbers can be expressed in a more practical fashion. Here, numbers are written in the form of a mantissa (<code>m</code>) and an exponent (<code>n</code>) with the construction <em>m</em> x 10^<em>n</em> or <em>m</em>E<em>n</em>. The mantissa component is a number between <code>1</code> and <code>10</code>. For instance, <code>2.5 x 10^9</code> can be used to represent the value 2,500,000,000 in scientific notation. In a similar way, 0.00000012 can be expressed as <code>1.2 x 10^-7</code>. Due to its ability to describe numbers more succinctly and its ease of calculation, scientific notation is widely employed in scientific and technical domains.</p>
<p>We have fine control over the formatting task, with the following options:</p>
<ul>
<li>decimals: choice of the number of decimal places, option to drop trailing zeros, and a choice of the decimal symbol</li>
<li>scaling: we can choose to scale targeted values by a multiplier value</li>
<li>pattern: option to use a text pattern for decoration of the formatted values</li>
<li>locale-based formatting: providing a locale ID will result in formatting specific to the chosen locale</li>
</ul>
<section id="parameters" class="level2">
<h2 class="anchored" data-anchor-id="parameters">Parameters</h2>
<p>columns : Union[str, List[str], None] The columns to target. Can either be a single column name or a series of column names provided in a list.</p>
<p>rows : Union[int, List[int], None] In conjunction with <code>columns</code>, we can specify which of their rows should undergo formatting. The default is all rows, resulting in all rows in <code>columns</code> being formatted. Alternatively, we can supply a list of row indices.</p>
<p>decimals : int The <code>decimals</code> values corresponds to the exact number of decimal places to use. A value such as <code>2.34</code> can, for example, be formatted with <code>0</code> decimal places and it would result in <code>"2"</code>. With <code>4</code> decimal places, the formatted value becomes <code>"2.3400"</code>. The trailing zeros can be removed with <code>drop_trailing_zeros=True</code>. If you always need <code>decimals = 0</code>, the <code>fmt_integer()</code> method should be considered.</p>
<p>n_sigfig : Optional[int] A option to format numbers to <em>n</em> significant figures. By default, this is <code>None</code> and thus number values will be formatted according to the number of decimal places set via <code>decimals</code>. If opting to format according to the rules of significant figures, <code>n_sigfig</code> must be a number greater than or equal to <code>1</code>. Any values passed to the <code>decimals</code> and <code>drop_trailing_zeros</code> arguments will be ignored.</p>
<p>drop_trailing_zeros : bool A boolean value that allows for removal of trailing zeros (those redundant zeros after the decimal mark).</p>
<p>drop_trailing_dec_mark : bool A boolean value that determines whether decimal marks should always appear even if there are no decimal digits to display after formatting (e.g., <code>23</code> becomes <code>23.</code> if <code>False</code>). By default trailing decimal marks are not shown.</p>
<p>scale_by : float All numeric values will be multiplied by the <code>scale_by</code> value before undergoing formatting. Since the <code>default</code> value is <code>1</code>, no values will be changed unless a different multiplier value is supplied.</p>
<p>exp_style : str Style of formatting to use for the scientific notation formatting. By default this is <code>"x10n"</code> but other options include using a single letter (e.g., <code>"e"</code>, <code>"E"</code>, etc.), a letter followed by a <code>"1"</code> to signal a minimum digit width of one, or <code>"low-ten"</code> for using a stylized <code>"10"</code> marker.</p>
<p>pattern : str A formatting pattern that allows for decoration of the formatted value. The formatted value is represented by the <code>{x}</code> (which can be used multiple times, if needed) and all other characters will be interpreted as string literals.</p>
<p>sep_mark : str The string to use as a separator between groups of digits. For example, using <code>sep_mark=","</code> with a value of <code>1000</code> would result in a formatted value of <code>"1,000"</code>. This argument is ignored if a <code>locale</code> is supplied (i.e., is not <code>None</code>).</p>
<p>dec_mark : str The string to be used as the decimal mark. For example, using <code>dec_mark=","</code> with the value <code>0.152</code> would result in a formatted value of <code>"0,152"</code>). This argument is ignored if a <code>locale</code> is supplied (i.e., is not <code>None</code>).</p>
<p>force_sign_m : bool Should the plus sign be shown for positive values of the mantissa (first component)? This would effectively show a sign for all values except zero on the first numeric component of the notation. If so, use <code>True</code> (the default for this is <code>False</code>), where only negative numbers will display a sign.</p>
<p>force_sign_n : bool Should the plus sign be shown for positive values of the exponent (second component)? This would effectively show a sign for all values except zero on the second numeric component of the notation. If so, use <code>True</code> (the default for this is <code>False</code>), where only negative numbers will display a sign.</p>
</section>
<section id="returns" class="level2">
<h2 class="anchored" data-anchor-id="returns">Returns</h2>
<p>GTData The GTData object is returned.</p>


</section>
</section>

</main> <!-- /main -->
Expand Down
4 changes: 4 additions & 0 deletions reference/GT.html
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,10 @@ <h2 class="anchored" data-anchor-id="attributes">Attributes</h2>
<td><a href="#great_tables.GT.fmt_percent">fmt_percent</a></td>
<td>Format values as a percentage.</td>
</tr>
<tr class="even">
<td><a href="#great_tables.GT.fmt_scientific">fmt_scientific</a></td>
<td>Format values to scientific notation.</td>
</tr>
</tbody>
</table>

Expand Down
2 changes: 1 addition & 1 deletion reference/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ <h2 class="anchored" data-anchor-id="formatting-column-data">Formatting column d
</tr>
<tr class="even">
<td><a href="../reference/GT.fmt_scientific.html#great_tables.GT.fmt_scientific">GT.fmt_scientific</a></td>
<td></td>
<td>Format values to scientific notation.</td>
</tr>
<tr class="odd">
<td><a href="../reference/GT.fmt_engineering.html#great_tables.GT.fmt_engineering">GT.fmt_engineering</a></td>
Expand Down
Loading

0 comments on commit ae8b586

Please sign in to comment.