Mercurial > repos > shellac > sam_consensus_v3
comparison env/lib/python3.9/site-packages/tabulate-0.8.9.dist-info/METADATA @ 0:4f3585e2f14b draft default tip
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
author | shellac |
---|---|
date | Mon, 22 Mar 2021 18:12:50 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:4f3585e2f14b |
---|---|
1 Metadata-Version: 2.1 | |
2 Name: tabulate | |
3 Version: 0.8.9 | |
4 Summary: Pretty-print tabular data | |
5 Home-page: https://github.com/astanin/python-tabulate | |
6 Author: Sergey Astanin | |
7 Author-email: s.astanin@gmail.com | |
8 License: MIT | |
9 Platform: UNKNOWN | |
10 Classifier: Development Status :: 4 - Beta | |
11 Classifier: License :: OSI Approved :: MIT License | |
12 Classifier: Operating System :: OS Independent | |
13 Classifier: Programming Language :: Python :: 2 | |
14 Classifier: Programming Language :: Python :: 2.7 | |
15 Classifier: Programming Language :: Python :: 3 | |
16 Classifier: Programming Language :: Python :: 3.5 | |
17 Classifier: Programming Language :: Python :: 3.6 | |
18 Classifier: Programming Language :: Python :: 3.7 | |
19 Classifier: Programming Language :: Python :: 3.8 | |
20 Classifier: Programming Language :: Python :: 3.9 | |
21 Classifier: Topic :: Software Development :: Libraries | |
22 Description-Content-Type: text/markdown | |
23 Provides-Extra: widechars | |
24 Requires-Dist: wcwidth ; extra == 'widechars' | |
25 | |
26 python-tabulate | |
27 =============== | |
28 | |
29 Pretty-print tabular data in Python, a library and a command-line | |
30 utility. | |
31 | |
32 The main use cases of the library are: | |
33 | |
34 - printing small tables without hassle: just one function call, | |
35 formatting is guided by the data itself | |
36 - authoring tabular data for lightweight plain-text markup: multiple | |
37 output formats suitable for further editing or transformation | |
38 - readable presentation of mixed textual and numeric data: smart | |
39 column alignment, configurable number formatting, alignment by a | |
40 decimal point | |
41 | |
42 Installation | |
43 ------------ | |
44 | |
45 To install the Python library and the command line utility, run: | |
46 | |
47 pip install tabulate | |
48 | |
49 The command line utility will be installed as `tabulate` to `bin` on | |
50 Linux (e.g. `/usr/bin`); or as `tabulate.exe` to `Scripts` in your | |
51 Python installation on Windows (e.g. | |
52 `C:\Python27\Scripts\tabulate.exe`). | |
53 | |
54 You may consider installing the library only for the current user: | |
55 | |
56 pip install tabulate --user | |
57 | |
58 In this case the command line utility will be installed to | |
59 `~/.local/bin/tabulate` on Linux and to | |
60 `%APPDATA%\Python\Scripts\tabulate.exe` on Windows. | |
61 | |
62 To install just the library on Unix-like operating systems: | |
63 | |
64 TABULATE_INSTALL=lib-only pip install tabulate | |
65 | |
66 On Windows: | |
67 | |
68 set TABULATE_INSTALL=lib-only | |
69 pip install tabulate | |
70 | |
71 The module provides just one function, `tabulate`, which takes a list of | |
72 lists or another tabular data type as the first argument, and outputs a | |
73 nicely formatted plain-text table: | |
74 | |
75 >>> from tabulate import tabulate | |
76 | |
77 >>> table = [["Sun",696000,1989100000],["Earth",6371,5973.6], | |
78 ... ["Moon",1737,73.5],["Mars",3390,641.85]] | |
79 >>> print(tabulate(table)) | |
80 ----- ------ ------------- | |
81 Sun 696000 1.9891e+09 | |
82 Earth 6371 5973.6 | |
83 Moon 1737 73.5 | |
84 Mars 3390 641.85 | |
85 ----- ------ ------------- | |
86 | |
87 The following tabular data types are supported: | |
88 | |
89 - list of lists or another iterable of iterables | |
90 - list or another iterable of dicts (keys as columns) | |
91 - dict of iterables (keys as columns) | |
92 - two-dimensional NumPy array | |
93 - NumPy record arrays (names as columns) | |
94 - pandas.DataFrame | |
95 | |
96 Examples in this file use Python2. Tabulate supports Python3 too. | |
97 | |
98 ### Headers | |
99 | |
100 The second optional argument named `headers` defines a list of column | |
101 headers to be used: | |
102 | |
103 >>> print(tabulate(table, headers=["Planet","R (km)", "mass (x 10^29 kg)"])) | |
104 Planet R (km) mass (x 10^29 kg) | |
105 -------- -------- ------------------- | |
106 Sun 696000 1.9891e+09 | |
107 Earth 6371 5973.6 | |
108 Moon 1737 73.5 | |
109 Mars 3390 641.85 | |
110 | |
111 If `headers="firstrow"`, then the first row of data is used: | |
112 | |
113 >>> print(tabulate([["Name","Age"],["Alice",24],["Bob",19]], | |
114 ... headers="firstrow")) | |
115 Name Age | |
116 ------ ----- | |
117 Alice 24 | |
118 Bob 19 | |
119 | |
120 If `headers="keys"`, then the keys of a dictionary/dataframe, or column | |
121 indices are used. It also works for NumPy record arrays and lists of | |
122 dictionaries or named tuples: | |
123 | |
124 >>> print(tabulate({"Name": ["Alice", "Bob"], | |
125 ... "Age": [24, 19]}, headers="keys")) | |
126 Age Name | |
127 ----- ------ | |
128 24 Alice | |
129 19 Bob | |
130 | |
131 ### Row Indices | |
132 | |
133 By default, only pandas.DataFrame tables have an additional column | |
134 called row index. To add a similar column to any other type of table, | |
135 pass `showindex="always"` or `showindex=True` argument to `tabulate()`. | |
136 To suppress row indices for all types of data, pass `showindex="never"` | |
137 or `showindex=False`. To add a custom row index column, pass | |
138 `showindex=rowIDs`, where `rowIDs` is some iterable: | |
139 | |
140 >>> print(tabulate([["F",24],["M",19]], showindex="always")) | |
141 - - -- | |
142 0 F 24 | |
143 1 M 19 | |
144 - - -- | |
145 | |
146 ### Table format | |
147 | |
148 There is more than one way to format a table in plain text. The third | |
149 optional argument named `tablefmt` defines how the table is formatted. | |
150 | |
151 Supported table formats are: | |
152 | |
153 - "plain" | |
154 - "simple" | |
155 - "github" | |
156 - "grid" | |
157 - "fancy\_grid" | |
158 - "pipe" | |
159 - "orgtbl" | |
160 - "jira" | |
161 - "presto" | |
162 - "pretty" | |
163 - "psql" | |
164 - "rst" | |
165 - "mediawiki" | |
166 - "moinmoin" | |
167 - "youtrack" | |
168 - "html" | |
169 - "unsafehtml" | |
170 - "latex" | |
171 - "latex\_raw" | |
172 - "latex\_booktabs" | |
173 - "latex\_longtable" | |
174 - "textile" | |
175 - "tsv" | |
176 | |
177 `plain` tables do not use any pseudo-graphics to draw lines: | |
178 | |
179 >>> table = [["spam",42],["eggs",451],["bacon",0]] | |
180 >>> headers = ["item", "qty"] | |
181 >>> print(tabulate(table, headers, tablefmt="plain")) | |
182 item qty | |
183 spam 42 | |
184 eggs 451 | |
185 bacon 0 | |
186 | |
187 `simple` is the default format (the default may change in future | |
188 versions). It corresponds to `simple_tables` in [Pandoc Markdown | |
189 extensions](http://johnmacfarlane.net/pandoc/README.html#tables): | |
190 | |
191 >>> print(tabulate(table, headers, tablefmt="simple")) | |
192 item qty | |
193 ------ ----- | |
194 spam 42 | |
195 eggs 451 | |
196 bacon 0 | |
197 | |
198 `github` follows the conventions of GitHub flavored Markdown. It | |
199 corresponds to the `pipe` format without alignment colons: | |
200 | |
201 >>> print(tabulate(table, headers, tablefmt="github")) | |
202 | item | qty | | |
203 |--------|-------| | |
204 | spam | 42 | | |
205 | eggs | 451 | | |
206 | bacon | 0 | | |
207 | |
208 `grid` is like tables formatted by Emacs' | |
209 [table.el](http://table.sourceforge.net/) package. It corresponds to | |
210 `grid_tables` in Pandoc Markdown extensions: | |
211 | |
212 >>> print(tabulate(table, headers, tablefmt="grid")) | |
213 +--------+-------+ | |
214 | item | qty | | |
215 +========+=======+ | |
216 | spam | 42 | | |
217 +--------+-------+ | |
218 | eggs | 451 | | |
219 +--------+-------+ | |
220 | bacon | 0 | | |
221 +--------+-------+ | |
222 | |
223 `fancy_grid` draws a grid using box-drawing characters: | |
224 | |
225 >>> print(tabulate(table, headers, tablefmt="fancy_grid")) | |
226 ╒════════╤═══════╕ | |
227 │ item │ qty │ | |
228 ╞════════╪═══════╡ | |
229 │ spam │ 42 │ | |
230 ├────────┼───────┤ | |
231 │ eggs │ 451 │ | |
232 ├────────┼───────┤ | |
233 │ bacon │ 0 │ | |
234 ╘════════╧═══════╛ | |
235 | |
236 `presto` is like tables formatted by Presto cli: | |
237 | |
238 >>> print(tabulate(table, headers, tablefmt="presto")) | |
239 item | qty | |
240 --------+------- | |
241 spam | 42 | |
242 eggs | 451 | |
243 bacon | 0 | |
244 | |
245 `pretty` attempts to be close to the format emitted by the PrettyTables | |
246 library: | |
247 | |
248 >>> print(tabulate(table, headers, tablefmt="pretty")) | |
249 +-------+-----+ | |
250 | item | qty | | |
251 +-------+-----+ | |
252 | spam | 42 | | |
253 | eggs | 451 | | |
254 | bacon | 0 | | |
255 +-------+-----+ | |
256 | |
257 `psql` is like tables formatted by Postgres' psql cli: | |
258 | |
259 >>> print(tabulate(table, headers, tablefmt="psql")) | |
260 +--------+-------+ | |
261 | item | qty | | |
262 |--------+-------| | |
263 | spam | 42 | | |
264 | eggs | 451 | | |
265 | bacon | 0 | | |
266 +--------+-------+ | |
267 | |
268 `pipe` follows the conventions of [PHP Markdown | |
269 Extra](http://michelf.ca/projects/php-markdown/extra/#table) extension. | |
270 It corresponds to `pipe_tables` in Pandoc. This format uses colons to | |
271 indicate column alignment: | |
272 | |
273 >>> print(tabulate(table, headers, tablefmt="pipe")) | |
274 | item | qty | | |
275 |:-------|------:| | |
276 | spam | 42 | | |
277 | eggs | 451 | | |
278 | bacon | 0 | | |
279 | |
280 `orgtbl` follows the conventions of Emacs | |
281 [org-mode](http://orgmode.org/manual/Tables.html), and is editable also | |
282 in the minor orgtbl-mode. Hence its name: | |
283 | |
284 >>> print(tabulate(table, headers, tablefmt="orgtbl")) | |
285 | item | qty | | |
286 |--------+-------| | |
287 | spam | 42 | | |
288 | eggs | 451 | | |
289 | bacon | 0 | | |
290 | |
291 `jira` follows the conventions of Atlassian Jira markup language: | |
292 | |
293 >>> print(tabulate(table, headers, tablefmt="jira")) | |
294 || item || qty || | |
295 | spam | 42 | | |
296 | eggs | 451 | | |
297 | bacon | 0 | | |
298 | |
299 `rst` formats data like a simple table of the | |
300 [reStructuredText](http://docutils.sourceforge.net/docs/user/rst/quickref.html#tables) | |
301 format: | |
302 | |
303 >>> print(tabulate(table, headers, tablefmt="rst")) | |
304 ====== ===== | |
305 item qty | |
306 ====== ===== | |
307 spam 42 | |
308 eggs 451 | |
309 bacon 0 | |
310 ====== ===== | |
311 | |
312 `mediawiki` format produces a table markup used in | |
313 [Wikipedia](http://www.mediawiki.org/wiki/Help:Tables) and on other | |
314 MediaWiki-based sites: | |
315 | |
316 >>> print(tabulate(table, headers, tablefmt="mediawiki")) | |
317 {| class="wikitable" style="text-align: left;" | |
318 |+ <!-- caption --> | |
319 |- | |
320 ! item !! align="right"| qty | |
321 |- | |
322 | spam || align="right"| 42 | |
323 |- | |
324 | eggs || align="right"| 451 | |
325 |- | |
326 | bacon || align="right"| 0 | |
327 |} | |
328 | |
329 `moinmoin` format produces a table markup used in | |
330 [MoinMoin](https://moinmo.in/) wikis: | |
331 | |
332 >>> print(tabulate(table, headers, tablefmt="moinmoin")) | |
333 || ''' item ''' || ''' quantity ''' || | |
334 || spam || 41.999 || | |
335 || eggs || 451 || | |
336 || bacon || || | |
337 | |
338 `youtrack` format produces a table markup used in Youtrack tickets: | |
339 | |
340 >>> print(tabulate(table, headers, tablefmt="youtrack")) | |
341 || item || quantity || | |
342 | spam | 41.999 | | |
343 | eggs | 451 | | |
344 | bacon | | | |
345 | |
346 `textile` format produces a table markup used in | |
347 [Textile](http://redcloth.org/hobix.com/textile/) format: | |
348 | |
349 >>> print(tabulate(table, headers, tablefmt="textile")) | |
350 |_. item |_. qty | | |
351 |<. spam |>. 42 | | |
352 |<. eggs |>. 451 | | |
353 |<. bacon |>. 0 | | |
354 | |
355 `html` produces standard HTML markup as an html.escape'd str | |
356 with a ._repr_html_ method so that Jupyter Lab and Notebook display the HTML | |
357 and a .str property so that the raw HTML remains accessible. | |
358 `unsafehtml` table format can be used if an unescaped HTML is required: | |
359 | |
360 >>> print(tabulate(table, headers, tablefmt="html")) | |
361 <table> | |
362 <tbody> | |
363 <tr><th>item </th><th style="text-align: right;"> qty</th></tr> | |
364 <tr><td>spam </td><td style="text-align: right;"> 42</td></tr> | |
365 <tr><td>eggs </td><td style="text-align: right;"> 451</td></tr> | |
366 <tr><td>bacon </td><td style="text-align: right;"> 0</td></tr> | |
367 </tbody> | |
368 </table> | |
369 | |
370 `latex` format creates a `tabular` environment for LaTeX markup, | |
371 replacing special characters like `_` or `\` to their LaTeX | |
372 correspondents: | |
373 | |
374 >>> print(tabulate(table, headers, tablefmt="latex")) | |
375 \begin{tabular}{lr} | |
376 \hline | |
377 item & qty \\ | |
378 \hline | |
379 spam & 42 \\ | |
380 eggs & 451 \\ | |
381 bacon & 0 \\ | |
382 \hline | |
383 \end{tabular} | |
384 | |
385 `latex_raw` behaves like `latex` but does not escape LaTeX commands and | |
386 special characters. | |
387 | |
388 `latex_booktabs` creates a `tabular` environment for LaTeX markup using | |
389 spacing and style from the `booktabs` package. | |
390 | |
391 `latex_longtable` creates a table that can stretch along multiple pages, | |
392 using the `longtable` package. | |
393 | |
394 ### Column alignment | |
395 | |
396 `tabulate` is smart about column alignment. It detects columns which | |
397 contain only numbers, and aligns them by a decimal point (or flushes | |
398 them to the right if they appear to be integers). Text columns are | |
399 flushed to the left. | |
400 | |
401 You can override the default alignment with `numalign` and `stralign` | |
402 named arguments. Possible column alignments are: `right`, `center`, | |
403 `left`, `decimal` (only for numbers), and `None` (to disable alignment). | |
404 | |
405 Aligning by a decimal point works best when you need to compare numbers | |
406 at a glance: | |
407 | |
408 >>> print(tabulate([[1.2345],[123.45],[12.345],[12345],[1234.5]])) | |
409 ---------- | |
410 1.2345 | |
411 123.45 | |
412 12.345 | |
413 12345 | |
414 1234.5 | |
415 ---------- | |
416 | |
417 Compare this with a more common right alignment: | |
418 | |
419 >>> print(tabulate([[1.2345],[123.45],[12.345],[12345],[1234.5]], numalign="right")) | |
420 ------ | |
421 1.2345 | |
422 123.45 | |
423 12.345 | |
424 12345 | |
425 1234.5 | |
426 ------ | |
427 | |
428 For `tabulate`, anything which can be parsed as a number is a number. | |
429 Even numbers represented as strings are aligned properly. This feature | |
430 comes in handy when reading a mixed table of text and numbers from a | |
431 file: | |
432 | |
433 >>> import csv ; from StringIO import StringIO | |
434 >>> table = list(csv.reader(StringIO("spam, 42\neggs, 451\n"))) | |
435 >>> table | |
436 [['spam', ' 42'], ['eggs', ' 451']] | |
437 >>> print(tabulate(table)) | |
438 ---- ---- | |
439 spam 42 | |
440 eggs 451 | |
441 ---- ---- | |
442 | |
443 | |
444 To disable this feature use `disable_numparse=True`. | |
445 | |
446 >>> print(tabulate.tabulate([["Ver1", "18.0"], ["Ver2","19.2"]], tablefmt="simple", disable_numparse=True)) | |
447 ---- ---- | |
448 Ver1 18.0 | |
449 Ver2 19.2 | |
450 ---- ---- | |
451 | |
452 | |
453 ### Custom column alignment | |
454 | |
455 `tabulate` allows a custom column alignment to override the above. The | |
456 `colalign` argument can be a list or a tuple of `stralign` named | |
457 arguments. Possible column alignments are: `right`, `center`, `left`, | |
458 `decimal` (only for numbers), and `None` (to disable alignment). | |
459 Omitting an alignment uses the default. For example: | |
460 | |
461 >>> print(tabulate([["one", "two"], ["three", "four"]], colalign=("right",)) | |
462 ----- ---- | |
463 one two | |
464 three four | |
465 ----- ---- | |
466 | |
467 ### Number formatting | |
468 | |
469 `tabulate` allows to define custom number formatting applied to all | |
470 columns of decimal numbers. Use `floatfmt` named argument: | |
471 | |
472 >>> print(tabulate([["pi",3.141593],["e",2.718282]], floatfmt=".4f")) | |
473 -- ------ | |
474 pi 3.1416 | |
475 e 2.7183 | |
476 -- ------ | |
477 | |
478 `floatfmt` argument can be a list or a tuple of format strings, one per | |
479 column, in which case every column may have different number formatting: | |
480 | |
481 >>> print(tabulate([[0.12345, 0.12345, 0.12345]], floatfmt=(".1f", ".3f"))) | |
482 --- ----- ------- | |
483 0.1 0.123 0.12345 | |
484 --- ----- ------- | |
485 | |
486 ### Text formatting | |
487 | |
488 By default, `tabulate` removes leading and trailing whitespace from text | |
489 columns. To disable whitespace removal, set the global module-level flag | |
490 `PRESERVE_WHITESPACE`: | |
491 | |
492 import tabulate | |
493 tabulate.PRESERVE_WHITESPACE = True | |
494 | |
495 ### Wide (fullwidth CJK) symbols | |
496 | |
497 To properly align tables which contain wide characters (typically | |
498 fullwidth glyphs from Chinese, Japanese or Korean languages), the user | |
499 should install `wcwidth` library. To install it together with | |
500 `tabulate`: | |
501 | |
502 pip install tabulate[widechars] | |
503 | |
504 Wide character support is enabled automatically if `wcwidth` library is | |
505 already installed. To disable wide characters support without | |
506 uninstalling `wcwidth`, set the global module-level flag | |
507 `WIDE_CHARS_MODE`: | |
508 | |
509 import tabulate | |
510 tabulate.WIDE_CHARS_MODE = False | |
511 | |
512 ### Multiline cells | |
513 | |
514 Most table formats support multiline cell text (text containing newline | |
515 characters). The newline characters are honored as line break | |
516 characters. | |
517 | |
518 Multiline cells are supported for data rows and for header rows. | |
519 | |
520 Further automatic line breaks are not inserted. Of course, some output | |
521 formats such as latex or html handle automatic formatting of the cell | |
522 content on their own, but for those that don't, the newline characters | |
523 in the input cell text are the only means to break a line in cell text. | |
524 | |
525 Note that some output formats (e.g. simple, or plain) do not represent | |
526 row delimiters, so that the representation of multiline cells in such | |
527 formats may be ambiguous to the reader. | |
528 | |
529 The following examples of formatted output use the following table with | |
530 a multiline cell, and headers with a multiline cell: | |
531 | |
532 >>> table = [["eggs",451],["more\nspam",42]] | |
533 >>> headers = ["item\nname", "qty"] | |
534 | |
535 `plain` tables: | |
536 | |
537 >>> print(tabulate(table, headers, tablefmt="plain")) | |
538 item qty | |
539 name | |
540 eggs 451 | |
541 more 42 | |
542 spam | |
543 | |
544 `simple` tables: | |
545 | |
546 >>> print(tabulate(table, headers, tablefmt="simple")) | |
547 item qty | |
548 name | |
549 ------ ----- | |
550 eggs 451 | |
551 more 42 | |
552 spam | |
553 | |
554 `grid` tables: | |
555 | |
556 >>> print(tabulate(table, headers, tablefmt="grid")) | |
557 +--------+-------+ | |
558 | item | qty | | |
559 | name | | | |
560 +========+=======+ | |
561 | eggs | 451 | | |
562 +--------+-------+ | |
563 | more | 42 | | |
564 | spam | | | |
565 +--------+-------+ | |
566 | |
567 `fancy_grid` tables: | |
568 | |
569 >>> print(tabulate(table, headers, tablefmt="fancy_grid")) | |
570 ╒════════╤═══════╕ | |
571 │ item │ qty │ | |
572 │ name │ │ | |
573 ╞════════╪═══════╡ | |
574 │ eggs │ 451 │ | |
575 ├────────┼───────┤ | |
576 │ more │ 42 │ | |
577 │ spam │ │ | |
578 ╘════════╧═══════╛ | |
579 | |
580 `pipe` tables: | |
581 | |
582 >>> print(tabulate(table, headers, tablefmt="pipe")) | |
583 | item | qty | | |
584 | name | | | |
585 |:-------|------:| | |
586 | eggs | 451 | | |
587 | more | 42 | | |
588 | spam | | | |
589 | |
590 `orgtbl` tables: | |
591 | |
592 >>> print(tabulate(table, headers, tablefmt="orgtbl")) | |
593 | item | qty | | |
594 | name | | | |
595 |--------+-------| | |
596 | eggs | 451 | | |
597 | more | 42 | | |
598 | spam | | | |
599 | |
600 `jira` tables: | |
601 | |
602 >>> print(tabulate(table, headers, tablefmt="jira")) | |
603 | item | qty | | |
604 | name | | | |
605 |:-------|------:| | |
606 | eggs | 451 | | |
607 | more | 42 | | |
608 | spam | | | |
609 | |
610 `presto` tables: | |
611 | |
612 >>> print(tabulate(table, headers, tablefmt="presto")) | |
613 item | qty | |
614 name | | |
615 --------+------- | |
616 eggs | 451 | |
617 more | 42 | |
618 spam | | |
619 | |
620 `pretty` tables: | |
621 | |
622 >>> print(tabulate(table, headers, tablefmt="pretty")) | |
623 +------+-----+ | |
624 | item | qty | | |
625 | name | | | |
626 +------+-----+ | |
627 | eggs | 451 | | |
628 | more | 42 | | |
629 | spam | | | |
630 +------+-----+ | |
631 | |
632 `psql` tables: | |
633 | |
634 >>> print(tabulate(table, headers, tablefmt="psql")) | |
635 +--------+-------+ | |
636 | item | qty | | |
637 | name | | | |
638 |--------+-------| | |
639 | eggs | 451 | | |
640 | more | 42 | | |
641 | spam | | | |
642 +--------+-------+ | |
643 | |
644 `rst` tables: | |
645 | |
646 >>> print(tabulate(table, headers, tablefmt="rst")) | |
647 ====== ===== | |
648 item qty | |
649 name | |
650 ====== ===== | |
651 eggs 451 | |
652 more 42 | |
653 spam | |
654 ====== ===== | |
655 | |
656 Multiline cells are not well supported for the other table formats. | |
657 | |
658 Usage of the command line utility | |
659 --------------------------------- | |
660 | |
661 Usage: tabulate [options] [FILE ...] | |
662 | |
663 FILE a filename of the file with tabular data; | |
664 if "-" or missing, read data from stdin. | |
665 | |
666 Options: | |
667 | |
668 -h, --help show this message | |
669 -1, --header use the first row of data as a table header | |
670 -o FILE, --output FILE print table to FILE (default: stdout) | |
671 -s REGEXP, --sep REGEXP use a custom column separator (default: whitespace) | |
672 -F FPFMT, --float FPFMT floating point number format (default: g) | |
673 -f FMT, --format FMT set output table format; supported formats: | |
674 plain, simple, github, grid, fancy_grid, pipe, | |
675 orgtbl, rst, mediawiki, html, latex, latex_raw, | |
676 latex_booktabs, latex_longtable, tsv | |
677 (default: simple) | |
678 | |
679 Performance considerations | |
680 -------------------------- | |
681 | |
682 Such features as decimal point alignment and trying to parse everything | |
683 as a number imply that `tabulate`: | |
684 | |
685 - has to "guess" how to print a particular tabular data type | |
686 - needs to keep the entire table in-memory | |
687 - has to "transpose" the table twice | |
688 - does much more work than it may appear | |
689 | |
690 It may not be suitable for serializing really big tables (but who's | |
691 going to do that, anyway?) or printing tables in performance sensitive | |
692 applications. `tabulate` is about two orders of magnitude slower than | |
693 simply joining lists of values with a tab, comma, or other separator. | |
694 | |
695 At the same time, `tabulate` is comparable to other table | |
696 pretty-printers. Given a 10x10 table (a list of lists) of mixed text and | |
697 numeric data, `tabulate` appears to be slower than `asciitable`, and | |
698 faster than `PrettyTable` and `texttable` The following mini-benchmark | |
699 was run in Python 3.8.3 in Windows 10 x64: | |
700 | |
701 ================================= ========== =========== | |
702 Table formatter time, μs rel. time | |
703 ================================= ========== =========== | |
704 csv to StringIO 12.5 1.0 | |
705 join with tabs and newlines 15.6 1.3 | |
706 asciitable (0.8.0) 191.4 15.4 | |
707 tabulate (0.8.9) 472.8 38.0 | |
708 tabulate (0.8.9, WIDE_CHARS_MODE) 789.6 63.4 | |
709 PrettyTable (0.7.2) 879.1 70.6 | |
710 texttable (1.6.2) 1352.2 108.6 | |
711 ================================= ========== =========== | |
712 | |
713 | |
714 Version history | |
715 --------------- | |
716 | |
717 The full version history can be found at the [changelog](https://github.com/astanin/python-tabulate/blob/master/CHANGELOG). | |
718 | |
719 How to contribute | |
720 ----------------- | |
721 | |
722 Contributions should include tests and an explanation for the changes | |
723 they propose. Documentation (examples, docstrings, README.md) should be | |
724 updated accordingly. | |
725 | |
726 This project uses [pytest](https://docs.pytest.org/) testing | |
727 framework and [tox](https://tox.readthedocs.io/) to automate testing in | |
728 different environments. Add tests to one of the files in the `test/` | |
729 folder. | |
730 | |
731 To run tests on all supported Python versions, make sure all Python | |
732 interpreters, `pytest` and `tox` are installed, then run `tox` in the root | |
733 of the project source tree. | |
734 | |
735 On Linux `tox` expects to find executables like `python2.6`, | |
736 `python2.7`, `python3.4` etc. On Windows it looks for | |
737 `C:\Python26\python.exe`, `C:\Python27\python.exe` and | |
738 `C:\Python34\python.exe` respectively. | |
739 | |
740 To test only some Python environments, use `-e` option. For example, to | |
741 test only against Python 2.7 and Python 3.8, run: | |
742 | |
743 tox -e py27,py38 | |
744 | |
745 in the root of the project source tree. | |
746 | |
747 To enable NumPy and Pandas tests, run: | |
748 | |
749 tox -e py27-extra,py38-extra | |
750 | |
751 (this may take a long time the first time, because NumPy and Pandas will | |
752 have to be installed in the new virtual environments) | |
753 | |
754 To fix code formatting: | |
755 | |
756 tox -e lint | |
757 | |
758 See `tox.ini` file to learn how to use to test | |
759 individual Python versions. | |
760 | |
761 Contributors | |
762 ------------ | |
763 | |
764 Sergey Astanin, Pau Tallada Crespí, Erwin Marsi, Mik Kocikowski, Bill | |
765 Ryder, Zach Dwiel, Frederik Rietdijk, Philipp Bogensberger, Greg | |
766 (anonymous), Stefan Tatschner, Emiel van Miltenburg, Brandon Bennett, | |
767 Amjith Ramanujam, Jan Schulz, Simon Percivall, Javier Santacruz | |
768 López-Cepero, Sam Denton, Alexey Ziyangirov, acaird, Cesar Sanchez, | |
769 naught101, John Vandenberg, Zack Dever, Christian Clauss, Benjamin | |
770 Maier, Andy MacKinlay, Thomas Roten, Jue Wang, Joe King, Samuel Phan, | |
771 Nick Satterly, Daniel Robbins, Dmitry B, Lars Butler, Andreas Maier, | |
772 Dick Marinus, Sébastien Celles, Yago González, Andrew Gaul, Wim Glenn, | |
773 Jean Michel Rouly, Tim Gates, John Vandenberg, Sorin Sbarnea, | |
774 Wes Turner, Andrew Tija, Marco Gorelli, Sean McGinnis, danja100, | |
775 endolith, Dominic Davis-Foster, pavlocat, Daniel Aslau, paulc, | |
776 Felix Yan, Shane Loretz, Frank Busse, Harsh Singh, Derek Weitzel, | |
777 Vladimir Vrzić, 서승우 (chrd5273), Georgy Frolov, Christian Cwienk, | |
778 Bart Broere, Vilhelm Prytz. | |
779 | |
780 |