[IPython-dev] Visual representation of SQL extracted data

Thomas Kluyver takowl at gmail.com
Thu May 15 21:54:00 EDT 2014

On 15 May 2014 18:46, Simon Cropper <simoncropper at fossworkflowguides.com>wrote:

> How do you use your scripts? Can you provide an example. I looked at
> your GIST but could not find an explanation of how to use it.

To create a table in one shot:

Table(TableHeaderRow('Planet', 'Orbit in Earth days'),
['Mercury', 88],
['Venus', 584])

To build it up row-by-row:

t = Table(TableHeaderRow('Planet', 'Orbit in Earth days'))
for planet in solar_system:
  t.append_row(planet.name, planet.orbit_time)

To display it:

t  # At the end of a cell
IPython.display.display(t)   # Anywhere in the code

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20140515/86cdf3af/attachment.html>

More information about the IPython-dev mailing list