AllenDowney/ThinkStats2 — pull request #12 by nirs (2014-12-19 09:59:53+00:00)
Title: Nicer iteraion over respondent file

The solution was iterating over the dictionary, getting the pregnum
value by matching resp.pregnum[caseid==caseid], which creates a boolean
array for all respondent and use it to filter pregnum values. This makes
sense when you want to get a single value, but not when you want to
iterated over all values.

Iterating over the pregnum series and accessing the caseid using the
index should be more efficient (I did not time it) and seems like a
better example code.