tabulate
UtilitiesPretty-print tables
What is tabulate?
Tabulate is a Python library for pretty-printing tabular data to the terminal. It supports dozens of output formats including plain text, grid, pipe (Markdown), HTML, LaTeX, and more. It works with lists of lists, dicts, Pandas DataFrames, and NumPy arrays.
In PyRun, tabulate is available via micropip and is an excellent way to present data output clearly in the terminal panel. It's commonly used with Pandas to display DataFrames in a human-readable format, or to generate Markdown tables from Python data.
Code Example
Pretty-print data in grid, outline, and Markdown formats.
from tabulate import tabulate
data = [
["Alice", 28, "Engineer", "New York"],
["Bob", 34, "Designer", "London"],
["Charlie", 22, "Data Sci.", "Berlin"],
["Diana", 30, "Manager", "Tokyo"],
]
headers = ["Name", "Age", "Role", "City"]
print("── grid ──")
print(tabulate(data, headers=headers, tablefmt="grid"))
print("\n── rounded_outline ──")
print(tabulate(data, headers=headers, tablefmt="rounded_outline"))
print("\n── pipe (Markdown) ──")
print(tabulate(data, headers=headers, tablefmt="pipe"))Why run tabulate in PyRun?
- ✦ Zero setup — no pip install, no virtual environment, no Python download
- ✦ Instant results — powered by WebAssembly, runs locally in your browser
- ✦ Share your code — generate a link and anyone can run it instantly
- ✦ Works offline — after first load, PyRun runs without internet
Related Packages
Recommended Python Resources
Expand your knowledge with related interactive tutorials, cheat sheets, and code comparisons.
Python Loops
Learn how to use Python loops to iterate over data. Master for loops, while loops, break, continue, and loop best practices with interactive examples.
How to Sort a List in Python
Learn how to sort a list in Python using the sort() method and the sorted() function. Discover custom key sorting and reverse order examples.
Python String Methods
A complete reference guide for Python string manipulation. Master formatting, searching, splitting, replacing, and checking string properties.
Python vs JavaScript: Which Programming Language is Best?
A comprehensive comparison between Python and JavaScript. Explore syntax differences, performance, use cases (backend vs frontend), and coding examples.