top | item 10145880

Pylsy: Python library to represent tabular data in ASCII tables

64 points| leviathan1995 | 10 years ago |github.com | reply

24 comments

order
[+] bru|10 years ago|reply
Isn't that exactly what tabulate has been doing very well for a while? https://pypi.python.org/pypi/tabulate

Note the variety of formats: 'ascii', but also html, latex & co.

[+] IanCal|10 years ago|reply
Tabulate is also excellent for the command line tool it provides, I use it to convert csv output into tables for GH comments all the time.
[+] viraptor|10 years ago|reply
PrettyTable is an established library which does the same: https://code.google.com/p/prettytable/
[+] roddux|10 years ago|reply
The introduction is almost identical: '[Pylsy/PrettyTable] is a simple Python library designed to make it quick and easy to represent tabular data in visually appealing ASCII tables'
[+] YesThatTom2|10 years ago|reply
I've used PrettyTable for years. I don't see how this improves upon it
[+] joepvd|10 years ago|reply
Cool!

Sorry for the plug, but this gawk program does something similar:

https://github.com/joepvd/table

Field splitting can be defined with all of (g)awks possibilities. Features different styles, among which unicode table borders.

[+] kbd|10 years ago|reply
Judging by this thread there are a surprising number of tools dedicated to this. Typically when I need tabular output I stick the data into a Pandas dataframe and its output format is usually good enough.
[+] ORioN63|10 years ago|reply
Incredible how everyone in this thread has a different opinion on what is the best python library that works with table.
[+] jiri|10 years ago|reply
Yeah. Probably, the reason is that you can code it easily in few hundred lines and it looks decent and cool.
[+] smellf|10 years ago|reply
To do this, I would just tab-delimit stdout and pipe through `column -t`. Though I can see how a dedicated lib would be better for some use cases.
[+] BetaCygni|10 years ago|reply
Takes up too much (vertical) space.
[+] asgard1024|10 years ago|reply
I agree - perhaps there should be an option to control where and if you want to have the vertical and horizontal lines?
[+] ipozgaj|10 years ago|reply
I've tried several of similar libraries, and still find `tabulate` the best.