It asked to update a few plugins too (markdown, IdeaVIM, bash support, etc). Edit: https://youtrack.jetbrains.com/issue/IDEA-164286. Top Android Studio Plugins for Android App Development,Top Plugins for Android Studio App Development,Best Android Studio Plugins.Latest version
Pretty-print tabular data
Pretty-print tabular data in Python, a library and a command-lineutility.
The main use cases of the library are:
- printing small tables without hassle: just one function call,formatting is guided by the data itself
- authoring tabular data for lightweight plain-text markup: multipleoutput formats suitable for further editing or transformation
- readable presentation of mixed textual and numeric data: smartcolumn alignment, configurable number formatting, alignment by adecimal point
To install the Python library and the command line utility, run:
The command line utility will be installed as
bin onLinux (e.g.
/usr/bin); or as
Scripts in yourPython installation on Windows (e.g.
You may consider installing the library only for the current user:
In this case the command line utility will be installed to
~/.local/bin/tabulate on Linux and to
%APPDATA%PythonScriptstabulate.exe on Windows.
To install just the library on Unix-like operating systems:
The module provides just one function,
tabulate, which takes a list oflists or another tabular data type as the first argument, and outputs anicely formatted plain-text table:
Youtrack Markdown Emoji
The following tabular data types are supported:
- list of lists or another iterable of iterables
- list or another iterable of dicts (keys as columns)
- dict of iterables (keys as columns)
- two-dimensional NumPy array
- NumPy record arrays (names as columns)
Examples in this file use Python2. Tabulate supports Python3 too.
The second optional argument named
headers defines a list of columnheaders to be used:
headers='firstrow', then the first row of data is used:
headers='keys', then the keys of a dictionary/dataframe, or columnindices are used. It also works for NumPy record arrays and lists ofdictionaries or named tuples:
By default, only pandas.DataFrame tables have an additional columncalled row index. To add a similar column to any other type of table,pass
showindex=True argument to
tabulate().To suppress row indices for all types of data, pass
showindex=False. To add a custom row index column, pass
rowIDs is some iterable:
There is more than one way to format a table in plain text. The thirdoptional argument named
tablefmt defines how the table is formatted.
Supported table formats are:
plain tables do not use any pseudo-graphics to draw lines:
simple is the default format (the default may change in futureversions). It corresponds to
simple_tables in Pandoc Markdownextensions:
github follows the conventions of GitHub flavored Markdown. Itcorresponds to the
pipe format without alignment colons:
grid is like tables formatted by Emacs'table.el package. It corresponds to
grid_tables in Pandoc Markdown extensions:
fancy_grid draws a grid using box-drawing characters:
presto is like tables formatted by Presto cli:
pretty attempts to be close to the format emitted by the PrettyTableslibrary:
psql is like tables formatted by Postgres' psql cli:
pipe follows the conventions of PHP MarkdownExtra extension.It corresponds to
pipe_tables in Pandoc. This format uses colons toindicate column alignment:
orgtbl follows the conventions of Emacsorg-mode, and is editable alsoin the minor orgtbl-mode. Hence its name:
jira follows the conventions of Atlassian Jira markup language:
rst formats data like a simple table of thereStructuredTextformat:
mediawiki format produces a table markup used inWikipedia and on otherMediaWiki-based sites:
moinmoin format produces a table markup used inMoinMoin wikis:
youtrack format produces a table markup used in Youtrack tickets:
textile format produces a table markup used inTextile format:
html produces standard HTML markup as an html.escape'd strwith a .repr_html method so that Jupyter Lab and Notebook display the HTMLand a .str property so that the raw HTML remains accessible.
unsafehtml table format can be used if an unescaped HTML is required:
latex format creates a
tabular environment for LaTeX markup,replacing special characters like
to their LaTeXcorrespondents:
latex_raw behaves like
latex but does not escape LaTeX commands andspecial characters.
latex_booktabs creates a
tabular environment for LaTeX markup usingspacing and style from the
latex_longtable creates a table that can stretch along multiple pages,using the
tabulate is smart about column alignment. It detects columns whichcontain only numbers, and aligns them by a decimal point (or flushesthem to the right if they appear to be integers). Text columns areflushed to the left.
You can override the default alignment with
stralignnamed arguments. Possible column alignments are:
decimal (only for numbers), and
None (to disable alignment).
Aligning by a decimal point works best when you need to compare numbersat a glance:
Compare this with a more common right alignment:
Looking for Mac fonts? Click to find the best 65 free fonts in the Mac style. Every font is free to download! You need to open Free Fonts from your Applications folder and then click the Copy Files button in the main window to save the folder of fonts to a location on your computer. You can then use Font Book to manage and install the fonts. Fonts for mac apple.
tabulate, anything which can be parsed as a number is a number.Even numbers represented as strings are aligned properly. This featurecomes in handy when reading a mixed table of text and numbers from afile:
To disable this feature use
Custom column alignment
tabulate allows a custom column alignment to override the above. The
colalign argument can be a list or a tuple of
stralign namedarguments. Possible column alignments are:
decimal (only for numbers), and
None (to disable alignment).Omitting an alignment uses the default. For example:
tabulate allows to define custom number formatting applied to allcolumns of decimal numbers. Use
floatfmt named argument:
floatfmt argument can be a list or a tuple of format strings, one percolumn, in which case every column may have different number formatting:
tabulate removes leading and trailing whitespace from textcolumns. To disable whitespace removal, set the global module-level flag
Wide (fullwidth CJK) symbols
To properly align tables which contain wide characters (typicallyfullwidth glyphs from Chinese, Japanese or Korean languages), the usershould install
wcwidth library. To install it together with
Wide character support is enabled automatically if
wcwidth library isalready installed. To disable wide characters support withoutuninstalling
wcwidth, set the global module-level flag
Most table formats support multiline cell text (text containing newlinecharacters). The newline characters are honored as line breakcharacters.
Multiline cells are supported for data rows and for header rows.
Further automatic line breaks are not inserted. Of course, some outputformats such as latex or html handle automatic formatting of the cellcontent on their own, but for those that don't, the newline charactersin the input cell text are the only means to break a line in cell text.
Note that some output formats (e.g. simple, or plain) do not representrow delimiters, so that the representation of multiline cells in suchformats may be ambiguous to the reader.
The following examples of formatted output use the following table witha multiline cell, and headers with a multiline cell:
Multiline cells are not well supported for the other table formats.
Usage of the command line utility
Such features as decimal point alignment and trying to parse everythingas a number imply that
- has to 'guess' how to print a particular tabular data type
- needs to keep the entire table in-memory
- has to 'transpose' the table twice
- does much more work than it may appear
It may not be suitable for serializing really big tables (but who'sgoing to do that, anyway?) or printing tables in performance sensitiveapplications.
tabulate is about two orders of magnitude slower thansimply joining lists of values with a tab, comma, or other separator.
At the same time,
tabulate is comparable to other tablepretty-printers. Given a 10x10 table (a list of lists) of mixed text andnumeric data,
tabulate appears to be slower than
asciitable, andfaster than
texttable The following mini-benchmarkwas run in Python 3.8.3 in Windows 10 x64:
The full version history can be found at the changelog.
How to contribute
Contributions should include tests and an explanation for the changesthey propose. Documentation (examples, docstrings, README.md) should beupdated accordingly.
This project uses pytest testingframework and tox to automate testing indifferent environments. Add tests to one of the files in the
To run tests on all supported Python versions, make sure all Pythoninterpreters,
tox are installed, then run
tox in the rootof the project source tree.
tox expects to find executables like
python3.4 etc. On Windows it looks for
To test only some Python environments, use
-e option. For example, totest only against Python 2.7 and Python 3.8, run:
in the root of the project source tree.
To enable NumPy and Pandas tests, run:
(this may take a long time the first time, because NumPy and Pandas willhave to be installed in the new virtual environments)
To fix code formatting:
tox.ini file to learn how to use to testindividual Python versions.
Sergey Astanin, Pau Tallada Crespí, Erwin Marsi, Mik Kocikowski, BillRyder, Zach Dwiel, Frederik Rietdijk, Philipp Bogensberger, Greg(anonymous), Stefan Tatschner, Emiel van Miltenburg, Brandon Bennett,Amjith Ramanujam, Jan Schulz, Simon Percivall, Javier SantacruzLópez-Cepero, Sam Denton, Alexey Ziyangirov, acaird, Cesar Sanchez,naught101, John Vandenberg, Zack Dever, Christian Clauss, BenjaminMaier, Andy MacKinlay, Thomas Roten, Jue Wang, Joe King, Samuel Phan,Nick Satterly, Daniel Robbins, Dmitry B, Lars Butler, Andreas Maier,Dick Marinus, Sébastien Celles, Yago González, Andrew Gaul, Wim Glenn,Jean Michel Rouly, Tim Gates, John Vandenberg, Sorin Sbarnea,Wes Turner, Andrew Tija, Marco Gorelli, Sean McGinnis, danja100,endolith, Dominic Davis-Foster, pavlocat, Daniel Aslau, paulc,Felix Yan, Shane Loretz, Frank Busse, Harsh Singh, Derek Weitzel,Vladimir Vrzić, 서승우 (chrd5273), Georgy Frolov, Christian Cwienk,Bart Broere, Vilhelm Prytz.
Release historyRelease notifications RSS feed
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size tabulate-0.8.9-py3-none-any.whl (25.1 kB)||File type Wheel||Python version py3||Upload date||Hashes|
|Filename, size tabulate-0.8.9.tar.gz (53.5 kB)||File type Source||Python version None||Upload date||Hashes|
Hashes for tabulate-0.8.9-py3-none-any.whl
Hashes for tabulate-0.8.9.tar.gz