Add Table.index method

Replaces `Table.get_sample_index` and `Table.get_observation_index`.

Also fixed some unrelated issues with broken code that `nosetests --with-doctest` uncovered.

Fixes #322.