A table is a structured arrangement of data in rows and columns that allows for easy sorting, filtering, and analysis.

It can be used in data visualization to present information in a clear, organized manner for quick comparison and interpretation.

Several strategies exist to build table wih Python. Tweaking matplotlib functions is doable but very verbose. pandas has a couple of utility functions. But plottable is definitely the best option. It is a powerful library and this section describes it ind depth.

Table with Plottable

Plottable is a python library for plotting nice table outputs. You can custom style, colors, add images and even more with a light python syntax!

Plottable is almost the single python library made especially for creating nice output tables. According to the main author, it's inspired from the R packages gt and reactable.

If you don't know this tool yet, I suggest starting with the introduction to plottable. It will teach you how to install the library and create a simple yet clean table with the Table() object.

The second chapter of the tutorial explains how to customize table colors. Learn how to highlight a cell, a row or a column, or even how to use a gradient color to transform a table in a heatmap.

Next, learn how to insert graphs in cells: barplot, donuts, stars and more. This can greatly improve the readability of your table, making it much more insightful.

Lastly, some additional tips like how to insert images in cells.

Pandas logo Table with Pandas

Pandas has a whole section dedicated to formatting table in its doc. It lists any features but I still advise to use plottable as documented above.


👋 This document is a work by Yan Holtz. You can contribute on github, send me a feedback on twitter or subscribe to the newsletter to know when new examples are published! 🔥