use map in place of generator in partitionby

We should avoid the use of generator expressions.  They prevent debugging systems from stepping into them.  This stops tools like `pdb` and `profile`.  We should prefer using builtins like `map` when possible.