Using TableFu to Crack Those Tables

Posted Friday, January 21, 2011 at 2:33 p.m. by Chris Amico in Projects about data, journalism, programming and Python

Note: in lieu of other excuses: I have a carnival of journalism post coming soon. Consider this an unrelated holdover to remind you that I do, in fact, still occasionally use this blog.

For a while now, I've been toying with a side project called TableFu. If you follow me on Twitter or Github, you've probably seen it. It might already be in your toolkit (if, for example, you needed to organize a bunch of Youtube videos of Christmas carols).

The project started as a Python port of ProPublica's project of the same name, which is written in Ruby. In part, this project was an effort to expose myself to Ruby, at least enough that I could translate it to Python.

Lately, though, the project has developed a bit more of its own character, and I've been using it in actual projects at work. Here's one example: Will Presidential Nomination 'Hostage-Taking' Lead to Confirmation Reforms?

I started with a dump of nominations data from the New York Times Congress API; you can see that here. Here's the script I used to aggregate outcomes by congress and result:

The filter and count methods are new, and filter returns a new TableFu instance, so it's possible to chain queries (that's actually what TableFu does internally if you pass in multiple keyword arguments).

Once the data was filtered and aggregated, I just charted it in a new Google Spreadsheet. Simple enough.

From there, if you want to get the raw or aggregated data on the web, check out Ben Welsh's TableStacker, which runs in AppEngine and closely resembles ProPublica's TableSetter.



Comments:

Comments are closed for this post. If you still have something to say, please email me.