Skip to content

Repository files navigation

ANSITable


Pretty tables and matrices for Python

PyPI version Documentation

GitHubCondaQuick example


Status & Project Health

Build Status Downloads Python Version Codacy Badge License: MIT

Ecosystem & Dependencies

A Python Robotics Package QUT Centre for Robotics Open Source

Quick example

from ansitable import ANSITable

table = ANSITable("Name", "Score", border="thin")
table.row("Alice", 95)
table.row("Bob", 87)
table.row("Carol", 92)
table.print()

Output:

┌───────┬───────┐
│ Name  │ Score │
├───────┼───────┤
│ Alice │    95 │
│   Bob │    87 │
│ Carol │    92 │
└───────┴───────┘

Features

  • Unicode and ANSI colors — Beautiful output in any ANSI-capable terminal
  • 7 export formats — Markdown, HTML, LaTeX, reStructuredText, Wikitable, CSV, Pandas
  • Rich styling — Colors, backgrounds, text styles (bold, underlined, etc.), alignment, width control
  • Sorting — Sort tables by any column, with optional key function
  • Pandas integration — Convert DataFrames to/from ANSITable
  • Matrix formatting — Pretty-print NumPy arrays with brackets and styles
  • Flexible API — Simple string-based or detailed Column-based column specification

Installation

pip install ansitable

Optional dependency for colors:

pip install colored

Documentation

See the comprehensive documentation for tutorials, examples, and API reference.

About

Quick, easy and pretty display of tabular data or matrices, with optional ANSI color and borders

Topics

Resources

Stars

21 stars

Watchers

1 watching

Forks

Releases

Sponsor this project

Packages

Contributors

Languages