Welcome, guest | Sign In | My Account | Store | Cart

Notice! PyPM is being replaced with the ActiveState Platform, which enhances PyPM’s build and deploy capabilities. Create your free Platform account to download ActivePython or customize Python with the packages you require and get automatic updates.

pypm install gviz-data-table

How to install gviz_data_table

  1. Download and install ActivePython
  2. Open Command Prompt
  3. Type pypm install gviz-data-table
 Python 2.7Python 3.2Python 3.3
Windows (32-bit)
Windows (64-bit)
Mac OS X (10.5+)
Linux (32-bit)
1.0.1 Available View build log
0.9.0 Available View build log
Linux (64-bit)
1.0.1 Available View build log
0.9.0 Available View build log
1.0.1 Available View build log
Lastest release
version 1.0.1 on Mar 25th, 2013

Gviz Data Table is a simple Python library for converting Python data types to the Google Visualization Data Table JSON format. https://developers.google.com/chart/interactive/docs/reference

The Google Visualization Library itself is a Javascript library that provides interactive charts that work in pretty much any browser. The libraries cover most use cases including tables as well as charts, so you can have a chart and a table of the same data.

Gviz Data Table is designed primarily for use with data sources such as databases. Usage is supposed to be minimal: you provide a schema, that is a list of columns, and the rows of data. A column must have a name and Python data type. It can also have a label which will be used for display, otherwise the name will be used.

Each row is a sequence of cells. Although columns are explicit row names are always the first cell in a row. Like columns, cells can also have labels. Gviz Data Table will validate each cell to make sure that data conforms to type specified in the schema and will map Python types to their JSON equivalent but it does not coerce any data, i.e. if a column has type int and a cell's data is a string containing numerical characters only this will still raise an exception.

Gviz Data Table handles data conversion only. You will need to add the necessary Javascript to an web page in order for any charts or table to be drawn. Tables, columns and cells can all have options which are just dictionaries. As there is no further definition of options no validation of their items occurs. Unknown items will simply be ignored.

Gviz Data Table is composed of: one container class "Table"; two data classes, Cell and Column and one JSON encoder. Application code should probably only ever need to use Table and the encoder.


Tables can be initialised with a schema or these can be added imperatively. Once one row has been added to a table no more columns can be added. Once all the rows have been added. The table can be converted into JSON using the encoder.


Let's say we have data representing the names and salaries of people

Name Salary
Jim 50
Bob 80

This could be coded in Gviz Data Table like this:

System Message: ERROR/3 (<string>, line 59)

Unknown directive type "code-block".

.. code-block:: python

   from gviz_data_table import Table

   table = Table()
   table.add_column('name', str, "Name")
   table.add_column(salary', int, "Salary")
   table.append(["Jim", 50])
   table.append(["Bob", 80])

This can be encoded into JSON using the encoder:

System Message: ERROR/3 (<string>, line 71)

Unknown directive type "code-block".

.. code-block:: python

   from gviz_data_table import encode


It can also be directly encoded

System Message: ERROR/3 (<string>, line 79)

Unknown directive type "code-block".

.. code-block:: python


And also used as a static data source for asynchronous loading from Javascript

System Message: ERROR/3 (<string>, line 85)

Unknown directive type "code-block".

.. code-block:: python


Complete documentation including the API at http://gviz-data-table.readthedocs.org/en/latest/

1.0.0 (2013-03-18)

  • Python 3 compatibile
  • Changed convenience import: encode replaces encoder
  • Added convenience methods to Table to allow direct encoding as JSON and a Google data source.

0.9.1 (2012-07-26)

  • Changed signature of add_column when I found I used it wrongly myself in

System Message: WARNING/2 (<string>, line 106)

Bullet list ends without a blank line; unexpected unindent.

the docs

0.9 (2012-07-25)

  • Initial release

Subscribe to package updates

Last updated Mar 25th, 2013

Download Stats

Last month:1

What does the lock icon mean?

Builds marked with a lock icon are only available via PyPM to users with a current ActivePython Business Edition subscription.

Need custom builds or support?

ActivePython Enterprise Edition guarantees priority access to technical support, indemnification, expert consulting and quality-assured language builds.

Plan on re-distributing ActivePython?

Get re-distribution rights and eliminate legal risks with ActivePython OEM Edition.