Skip to content

petercorke/ansitable

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

159 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PyPI version fury.io Anaconda version pyversions Build Status Maintenance GitHub license PyPI - Downloads Codacy Badge

ANSITable logo

ANSITable

Pretty tables and matrices for Python

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.

Releases

Packages

Contributors

Languages