113 lines
21 KiB
HTML
Vendored
113 lines
21 KiB
HTML
Vendored
<!DOCTYPE html PUBLIC ""
|
|
"">
|
|
<html><head><meta charset="UTF-8" /><title>tech.v3.dataset.print documentation</title><script async="true" src="https://www.googletagmanager.com/gtag/js?id=G-RGTB4J7LGP"></script><script>window.dataLayer = window.dataLayer || [];
|
|
function gtag(){dataLayer.push(arguments);}
|
|
gtag('js', new Date());
|
|
|
|
gtag('config', 'G-95TVFC1FEB');</script><link rel="stylesheet" type="text/css" href="css/default.css" /><link rel="stylesheet" type="text/css" href="highlight/solarized-light.css" /><script type="text/javascript" src="highlight/highlight.min.js"></script><script type="text/javascript" src="js/jquery.min.js"></script><script type="text/javascript" src="js/page_effects.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body><div id="header"><h2>Generated by <a href="https://github.com/weavejester/codox">Codox</a> with <a href="https://github.com/xsc/codox-theme-rdash">RDash UI</a> theme</h2><h1><a href="index.html"><span class="project-title"><span class="project-name">TMD</span> <span class="project-version">8.003</span></span></a></h1></div><div class="sidebar primary"><h3 class="no-link"><span class="inner">Project</span></h3><ul class="index-link"><li class="depth-1 "><a href="index.html"><div class="inner">Index</div></a></li></ul><h3 class="no-link"><span class="inner">Topics</span></h3><ul><li class="depth-1 "><a href="000-getting-started.html"><div class="inner"><span>tech.ml.dataset Getting Started</span></div></a></li><li class="depth-1 "><a href="100-walkthrough.html"><div class="inner"><span>tech.ml.dataset Walkthrough</span></div></a></li><li class="depth-1 "><a href="200-quick-reference.html"><div class="inner"><span>tech.ml.dataset Quick Reference</span></div></a></li><li class="depth-1 "><a href="columns-readers-and-datatypes.html"><div class="inner"><span>tech.ml.dataset Columns, Readers, and Datatypes</span></div></a></li><li class="depth-1 "><a href="nippy-serialization-rocks.html"><div class="inner"><span>tech.ml.dataset And nippy</span></div></a></li><li class="depth-1 "><a href="supported-datatypes.html"><div class="inner"><span>tech.ml.dataset Supported Datatypes</span></div></a></li></ul><h3 class="no-link"><span class="inner">Namespaces</span></h3><ul><li class="depth-1"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>tech</span></div></div></li><li class="depth-2"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>v3</span></div></div></li><li class="depth-3"><a href="tech.v3.dataset.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>dataset</span></div></a></li><li class="depth-4 branch"><a href="tech.v3.dataset.categorical.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>categorical</span></div></a></li><li class="depth-4 branch"><a href="tech.v3.dataset.clipboard.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>clipboard</span></div></a></li><li class="depth-4 branch"><a href="tech.v3.dataset.column.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>column</span></div></a></li><li class="depth-4 branch"><a href="tech.v3.dataset.column-filters.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>column-filters</span></div></a></li><li class="depth-4"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>io</span></div></div></li><li class="depth-5 branch"><a href="tech.v3.dataset.io.csv.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>csv</span></div></a></li><li class="depth-5 branch"><a href="tech.v3.dataset.io.datetime.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>datetime</span></div></a></li><li class="depth-5 branch"><a href="tech.v3.dataset.io.string-row-parser.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>string-row-parser</span></div></a></li><li class="depth-5"><a href="tech.v3.dataset.io.univocity.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>univocity</span></div></a></li><li class="depth-4 branch"><a href="tech.v3.dataset.join.html"><div class="inner"><span class="tree" style="top: -145px;"><span class="top" style="height: 154px;"></span><span class="bottom"></span></span><span>join</span></div></a></li><li class="depth-4 branch"><a href="tech.v3.dataset.math.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>math</span></div></a></li><li class="depth-4 branch"><a href="tech.v3.dataset.metamorph.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>metamorph</span></div></a></li><li class="depth-4 branch"><a href="tech.v3.dataset.modelling.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>modelling</span></div></a></li><li class="depth-4 branch current"><a href="tech.v3.dataset.print.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>print</span></div></a></li><li class="depth-4"><a href="tech.v3.dataset.reductions.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>reductions</span></div></a></li><li class="depth-5"><a href="tech.v3.dataset.reductions.apache-data-sketch.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>apache-data-sketch</span></div></a></li><li class="depth-4 branch"><a href="tech.v3.dataset.rolling.html"><div class="inner"><span class="tree" style="top: -52px;"><span class="top" style="height: 61px;"></span><span class="bottom"></span></span><span>rolling</span></div></a></li><li class="depth-4 branch"><a href="tech.v3.dataset.set.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>set</span></div></a></li><li class="depth-4 branch"><a href="tech.v3.dataset.tensor.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>tensor</span></div></a></li><li class="depth-4"><a href="tech.v3.dataset.zip.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>zip</span></div></a></li><li class="depth-3"><div class="no-link"><div class="inner"><span class="tree" style="top: -641px;"><span class="top" style="height: 650px;"></span><span class="bottom"></span></span><span>libs</span></div></div></li><li class="depth-4 branch"><a href="tech.v3.libs.arrow.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>arrow</span></div></a></li><li class="depth-4 branch"><a href="tech.v3.libs.clj-transit.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>clj-transit</span></div></a></li><li class="depth-4 branch"><a href="tech.v3.libs.fastexcel.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>fastexcel</span></div></a></li><li class="depth-4"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>guava</span></div></div></li><li class="depth-5"><a href="tech.v3.libs.guava.cache.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>cache</span></div></a></li><li class="depth-4 branch"><a href="tech.v3.libs.parquet.html"><div class="inner"><span class="tree" style="top: -52px;"><span class="top" style="height: 61px;"></span><span class="bottom"></span></span><span>parquet</span></div></a></li><li class="depth-4 branch"><a href="tech.v3.libs.poi.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>poi</span></div></a></li><li class="depth-4"><a href="tech.v3.libs.tribuo.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>tribuo</span></div></a></li></ul></div><div class="sidebar secondary"><h3><a href="#top"><span class="inner">Public Vars</span></a></h3><ul><li class="depth-1"><a href="tech.v3.dataset.print.html#var-dataset-.3Estr"><div class="inner"><span>dataset->str</span></div></a></li><li class="depth-1"><a href="tech.v3.dataset.print.html#var-dataset-data-.3Estr"><div class="inner"><span>dataset-data->str</span></div></a></li><li class="depth-1"><a href="tech.v3.dataset.print.html#var-print-policy"><div class="inner"><span>print-policy</span></div></a></li><li class="depth-1"><a href="tech.v3.dataset.print.html#var-print-range"><div class="inner"><span>print-range</span></div></a></li><li class="depth-1"><a href="tech.v3.dataset.print.html#var-print-types"><div class="inner"><span>print-types</span></div></a></li><li class="depth-1"><a href="tech.v3.dataset.print.html#var-print-width"><div class="inner"><span>print-width</span></div></a></li></ul></div><div class="namespace-docs" id="content"><h1 class="anchor" id="top">tech.v3.dataset.print</h1><div class="doc"><div class="markdown"></div></div><div class="public anchor" id="var-dataset-.3Estr"><h3>dataset->str</h3><div class="usage"><code>(dataset->str ds options)</code><code>(dataset->str ds)</code></div><div class="doc"><div class="markdown"><p>Convert a dataset to a string. Prints a single line header and then calls
|
|
dataset-data->str.</p>
|
|
<p>For options documentation see dataset-data->str.</p>
|
|
</div></div><div class="src-link"><a href="https://github.com/techascent/tech.ml.dataset/blob/master/src/tech/v3/dataset/print.clj#L319">view source</a></div></div><div class="public anchor" id="var-dataset-data-.3Estr"><h3>dataset-data->str</h3><div class="usage"><code>(dataset-data->str dataset)</code><code>(dataset-data->str dataset options)</code></div><div class="doc"><div class="markdown"><p>Convert the dataset values to a string.</p>
|
|
<p>Options may be provided in the dataset metadata or may be provided
|
|
as an options map. The options map overrides the dataset metadata.</p>
|
|
<ul>
|
|
<li><code>:print-index-range</code> - The set of indexes to print. If an integer then
|
|
is interpreted according to <code>:print-style</code>. Defaults to the integer
|
|
<code>*default-table-row-print-length*</code>.</li>
|
|
<li><code>:print-style</code> - Defaults to :first-last. Options are #{:first-last :first :last}. In
|
|
the case <code>:print-index-range</code> is an integer and the dataset has more than that number of
|
|
rows prints the first N/2 and last N/2 rows or the first N or last N rows.</li>
|
|
<li><code>:print-line-policy</code> - defaults to <code>:repl</code> - one of:
|
|
<ul>
|
|
<li><code>:repl</code> - multiline table - default nice printing for repl</li>
|
|
<li><code>:markdown</code> - lines delimited by <br /></li>
|
|
<li><code>:single</code> - Only print first line</li>
|
|
</ul>
|
|
</li>
|
|
<li><code>:print-column-max-width</code> - set the max width of a column when printing.</li>
|
|
<li><code>:print-column-types?</code> - show/hide column types.</li>
|
|
<li><code>:maximum-precision</code> - When provided, the maximum double precision as an integer.</li>
|
|
<li><code>:elide-header?</code> - When true, the header such as <code>test/data/alldtypes.arrow-feather-compressed [1000 15]:</code> is hidden.</li>
|
|
</ul>
|
|
<p>Examples of print styles:</p>
|
|
<pre><code class="language-clojure">user> (require '[tech.v3.dataset :as ds])
|
|
nil
|
|
user> (require '[tech.v3.libs.arrow :as arrow])
|
|
nil
|
|
user> (def ds (ds/->dataset "test/data/alldtypes.arrow-feather-compressed" {:file-type :arrow}))
|
|
08:26:03.156 [tech.resource.gc ref thread] INFO tech.v3.resource.gc - Reference thread starting
|
|
#'user/ds
|
|
|
|
user> (vary-meta ds assoc :print-style :last :print-index-range 10)
|
|
test/data/alldtypes.arrow-feather-compressed [1000 15]:
|
|
|
|
| uints | longs | ubytes | strings | doubles | ushorts | local_times | local_dates | ints | instants | shorts | bytes | boolean | floats | text |
|
|
|------:|------:|-------:|---------|--------:|--------:|--------------|-------------|-----:|--------------------:|-------:|------:|---------|-------:|------|
|
|
| 990 | 990 | 222 | 990 | 990.0 | 990 | 13:39:59.923 | 2022-02-19 | 990 | 1645303199916000000 | 990 | -34 | | 990.0 | 990 |
|
|
| 991 | 991 | 223 | 991 | 991.0 | 991 | 13:39:59.923 | 2022-02-19 | 991 | 1645303199916000000 | 991 | -33 | | 991.0 | 991 |
|
|
| 992 | 992 | 224 | 992 | 992.0 | 992 | 13:39:59.923 | 2022-02-19 | 992 | 1645303199916000000 | 992 | -32 | | 992.0 | 992 |
|
|
| 993 | 993 | 225 | 993 | 993.0 | 993 | 13:39:59.923 | 2022-02-19 | 993 | 1645303199916000000 | 993 | -31 | | 993.0 | 993 |
|
|
| 994 | 994 | 226 | 994 | 994.0 | 994 | 13:39:59.923 | 2022-02-19 | 994 | 1645303199916000000 | 994 | -30 | | 994.0 | 994 |
|
|
| 995 | 995 | 227 | 995 | 995.0 | 995 | 13:39:59.923 | 2022-02-19 | 995 | 1645303199916000000 | 995 | -29 | | 995.0 | 995 |
|
|
| 996 | 996 | 228 | 996 | 996.0 | 996 | 13:39:59.923 | 2022-02-19 | 996 | 1645303199916000000 | 996 | -28 | | 996.0 | 996 |
|
|
| 997 | 997 | 229 | 997 | 997.0 | 997 | 13:39:59.923 | 2022-02-19 | 997 | 1645303199916000000 | 997 | -27 | | 997.0 | 997 |
|
|
| 998 | 998 | 230 | 998 | 998.0 | 998 | 13:39:59.923 | 2022-02-19 | 998 | 1645303199916000000 | 998 | -26 | | 998.0 | 998 |
|
|
| 999 | 999 | 231 | 999 | 999.0 | 999 | 13:39:59.923 | 2022-02-19 | 999 | 1645303199916000000 | 999 | -25 | | 999.0 | 999 |
|
|
user> (vary-meta ds assoc :print-style :first :print-index-range 10)
|
|
test/data/alldtypes.arrow-feather-compressed [1000 15]:
|
|
|
|
| uints | longs | ubytes | strings | doubles | ushorts | local_times | local_dates | ints | instants | shorts | bytes | boolean | floats | text |
|
|
|------:|------:|-------:|---------|--------:|--------:|--------------|-------------|-----:|--------------------:|-------:|------:|---------|-------:|------|
|
|
| 0 | 0 | 0 | 0 | 0.0 | 0 | 13:39:59.908 | 2022-02-19 | 0 | 1645303199909000000 | 0 | 0 | true | 0.0 | 0 |
|
|
| 1 | 1 | 1 | 1 | 1.0 | 1 | 13:39:59.910 | 2022-02-19 | 1 | 1645303199911000000 | 1 | 1 | false | 1.0 | 1 |
|
|
| 2 | 2 | 2 | 2 | 2.0 | 2 | 13:39:59.910 | 2022-02-19 | 2 | 1645303199911000000 | 2 | 2 | true | 2.0 | 2 |
|
|
| 3 | 3 | 3 | 3 | 3.0 | 3 | 13:39:59.910 | 2022-02-19 | 3 | 1645303199911000000 | 3 | 3 | true | 3.0 | 3 |
|
|
| 4 | 4 | 4 | 4 | 4.0 | 4 | 13:39:59.910 | 2022-02-19 | 4 | 1645303199911000000 | 4 | 4 | false | 4.0 | 4 |
|
|
| 5 | 5 | 5 | 5 | 5.0 | 5 | 13:39:59.910 | 2022-02-19 | 5 | 1645303199911000000 | 5 | 5 | false | 5.0 | 5 |
|
|
| 6 | 6 | 6 | 6 | 6.0 | 6 | 13:39:59.910 | 2022-02-19 | 6 | 1645303199911000000 | 6 | 6 | true | 6.0 | 6 |
|
|
| 7 | 7 | 7 | 7 | 7.0 | 7 | 13:39:59.910 | 2022-02-19 | 7 | 1645303199911000000 | 7 | 7 | false | 7.0 | 7 |
|
|
| 8 | 8 | 8 | 8 | 8.0 | 8 | 13:39:59.910 | 2022-02-19 | 8 | 1645303199911000000 | 8 | 8 | false | 8.0 | 8 |
|
|
| 9 | 9 | 9 | 9 | 9.0 | 9 | 13:39:59.910 | 2022-02-19 | 9 | 1645303199911000000 | 9 | 9 | true | 9.0 | 9 |
|
|
|
|
;; first-last is default with print-index-range of 20
|
|
user> (vary-meta ds assoc :print-style :first-last :print-index-range 10)
|
|
test/data/alldtypes.arrow-feather-compressed [1000 15]:
|
|
|
|
| uints | longs | ubytes | strings | doubles | ushorts | local_times | local_dates | ints | instants | shorts | bytes | boolean | floats | text |
|
|
|------:|------:|-------:|---------|--------:|--------:|--------------|-------------|-----:|--------------------:|-------:|------:|---------|-------:|------|
|
|
| 0 | 0 | 0 | 0 | 0.0 | 0 | 13:39:59.908 | 2022-02-19 | 0 | 1645303199909000000 | 0 | 0 | true | 0.0 | 0 |
|
|
| 1 | 1 | 1 | 1 | 1.0 | 1 | 13:39:59.910 | 2022-02-19 | 1 | 1645303199911000000 | 1 | 1 | false | 1.0 | 1 |
|
|
| 2 | 2 | 2 | 2 | 2.0 | 2 | 13:39:59.910 | 2022-02-19 | 2 | 1645303199911000000 | 2 | 2 | true | 2.0 | 2 |
|
|
| 3 | 3 | 3 | 3 | 3.0 | 3 | 13:39:59.910 | 2022-02-19 | 3 | 1645303199911000000 | 3 | 3 | true | 3.0 | 3 |
|
|
| 4 | 4 | 4 | 4 | 4.0 | 4 | 13:39:59.910 | 2022-02-19 | 4 | 1645303199911000000 | 4 | 4 | false | 4.0 | 4 |
|
|
| ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
|
|
| 994 | 994 | 226 | 994 | 994.0 | 994 | 13:39:59.923 | 2022-02-19 | 994 | 1645303199916000000 | 994 | -30 | | 994.0 | 994 |
|
|
| 995 | 995 | 227 | 995 | 995.0 | 995 | 13:39:59.923 | 2022-02-19 | 995 | 1645303199916000000 | 995 | -29 | | 995.0 | 995 |
|
|
| 996 | 996 | 228 | 996 | 996.0 | 996 | 13:39:59.923 | 2022-02-19 | 996 | 1645303199916000000 | 996 | -28 | | 996.0 | 996 |
|
|
| 997 | 997 | 229 | 997 | 997.0 | 997 | 13:39:59.923 | 2022-02-19 | 997 | 1645303199916000000 | 997 | -27 | | 997.0 | 997 |
|
|
| 998 | 998 | 230 | 998 | 998.0 | 998 | 13:39:59.923 | 2022-02-19 | 998 | 1645303199916000000 | 998 | -26 | | 998.0 | 998 |
|
|
| 999 | 999 | 231 | 999 | 999.0 | 999 | 13:39:59.923 | 2022-02-19 | 999 | 1645303199916000000 | 999 | -25 | | 999.0 | 999 |
|
|
</code></pre>
|
|
<p>Example of conservative printing:</p>
|
|
<pre><code class="language-clojure">tech.ml.dataset.github-test> (def ds (with-meta ds
|
|
(assoc (meta ds)
|
|
:print-column-max-width 25
|
|
:print-line-policy :single)))
|
|
</code></pre>
|
|
</div></div><div class="src-link"><a href="https://github.com/techascent/tech.ml.dataset/blob/master/src/tech/v3/dataset/print.clj#L99">view source</a></div></div><div class="public anchor" id="var-print-policy"><h3>print-policy</h3><div class="usage"><code>(print-policy dataset line-policy)</code></div><div class="doc"><div class="markdown"><p>Convenience function to vary printing behavior.</p>
|
|
<p>Defaults to <code>:repl</code> - one of:</p>
|
|
<ul>
|
|
<li><code>:repl</code> - multiline table - default nice printing for repl</li>
|
|
<li><code>:markdown</code> - lines delimited by <br /></li>
|
|
<li><code>:single</code> - Only print first line</li>
|
|
</ul>
|
|
</div></div><div class="src-link"><a href="https://github.com/techascent/tech.ml.dataset/blob/master/src/tech/v3/dataset/print.clj#L354">view source</a></div></div><div class="public anchor" id="var-print-range"><h3>print-range</h3><div class="usage"><code>(print-range dataset index-range)</code></div><div class="doc"><div class="markdown"><p>Convenience function to set the number of rows to print.</p>
|
|
<p>Defaults to (range <em>default-table-row-print-length</em>) - one of:</p>
|
|
<ul>
|
|
<li>n - prints the first n rows</li>
|
|
<li>range - prints the rows at positions corresponding to the range</li>
|
|
<li><code>:all</code> - prints all the rows in a dataset</li>
|
|
</ul>
|
|
</div></div><div class="src-link"><a href="https://github.com/techascent/tech.ml.dataset/blob/master/src/tech/v3/dataset/print.clj#L343">view source</a></div></div><div class="public anchor" id="var-print-types"><h3>print-types</h3><div class="usage"><code>(print-types dataset column-types)</code></div><div class="doc"><div class="markdown"><p>Convenience function to show/hide column types</p>
|
|
</div></div><div class="src-link"><a href="https://github.com/techascent/tech.ml.dataset/blob/master/src/tech/v3/dataset/print.clj#L372">view source</a></div></div><div class="public anchor" id="var-print-width"><h3>print-width</h3><div class="usage"><code>(print-width dataset column-width)</code></div><div class="doc"><div class="markdown"><p>Convenience function to set the max width of a column when printing.</p>
|
|
</div></div><div class="src-link"><a href="https://github.com/techascent/tech.ml.dataset/blob/master/src/tech/v3/dataset/print.clj#L365">view source</a></div></div></div></body></html> |