Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Pylsy: Python library to represent tabular data in ASCII tables (github.com/leviathan1995)
64 points by leviathan1995 on Aug 31, 2015 | hide | past | favorite | 24 comments


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.


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.


PrettyTable is an established library which does the same: https://code.google.com/p/prettytable/


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'


I noticed that too. The copy paste is strong in this one.


I've used PrettyTable for years. I don't see how this improves upon it


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.


Nice utility! I've written a quick clone of it in Tcl for use on systems without GNU Awk: http://wiki.tcl.tk/41682.


Aha! That must have been the first time I have tried to read Tcl for more than a minute :) Looks like one can prototype fast in this language. Thanks for writing / posting!


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.


This is my choice for tables on Python - https://github.com/Robpol86/terminaltables. The appearance of tables is adequately configurable. The project is also actively maintained unlike some of the others.


Incredible how everyone in this thread has a different opinion on what is the best python library that works with table.


Yeah. Probably, the reason is that you can code it easily in few hundred lines and it looks decent and cool.


It's basically this in real time! https://xkcd.com/927/


If anyone interested in similar library in C language, take a look at my simple libTprint library: https://github.com/wizzard/libtprint Hope it helps!


This recalls some of the table formatting and exporting magic one can easily achieve with emacs org-mode. http://orgmode.org/guide/Tables.html And there, if you like, you can include a full set of spreadsheet operations.


Cool project. You might be able to use Hypothesis (https://hypothesis.readthedocs.org/en/master/) for testing this to make sure you catch all of the little edge cases.


csvlook [0] is another great tool that does this for any CSV file. It's part of the very useful csvkit[1] suite of command line utilities for working with CSV files.

[0] http://csvkit.readthedocs.org/en/latest/scripts/csvlook.html

[1] http://csvkit.readthedocs.org/en/latest/index.html



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.


Takes up too much (vertical) space.


I agree - perhaps there should be an option to control where and if you want to have the vertical and horizontal lines?


I've tried several of similar libraries, and still find `tabulate` the best.


Suggest a move to "Show HN"




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: