[IPython-dev] IPyTables - simple table construction for IPython

Jason Grout jason-sage at creativetrax.com
Wed Mar 6 10:18:55 EST 2013


On 3/6/13 6:16 AM, Thomas Kluyver wrote:
> Working in the Notebook recently, I've found that I often want to
> display results in a table. pandas' DataFrames display nicely, but
> they're not terribly convenient if your data isn't already in that form,
> and I found myself assembling HTML in my code.
>
> Enter IPyTables. It's a simple interface to build tables for display in
> the notebook. At the easiest, you just pass in a series of tuples:
>
> Table((4, 1, 8),
>        (9, 7, 3),
>        (5, 2, 6))
>
> With a little bit more effort, you can add header cells and customise
> the formatting.
>
> Demo: http://nbviewer.ipython.org/5098827
> Module: https://gist.github.com/takluyver/5098835
>
> This is a prototype that I've thrown together quickly: feedback is very
> welcome. Obvious extensions include:
>
> - Expose more style attributes for customisation (so far it's just text
> and background colour)
> - Add a plain text repr(), so that tables are useable in the terminal
>


Cool!

Another cool thing would be a cell decorator that let you paste in csv 
data or space-separated data:

%%table
1 2 3
4 5 6
7 8 9

or

%%table
1,2,3
4,5,6
7,8,9

Especially if somehow that list of lists could be assigned to a variable.

Thanks,

Jason





More information about the IPython-dev mailing list