Message160825
groupby() changes the group when the key changes in the input it iterates. If you want to have p1 and p3 to go to the same group, you need to sort the input by P.key first.
This is clearly documented, too:
The operation of groupby() is similar to the uniq filter in Unix.
It generates a break or new group every time the value of the key
function changes (which is why it is usually necessary to have
sorted the data using the same key function). That behavior differs
from SQL’s GROUP BY which aggregates common elements regardless of
their input order. |
|
Date |
User |
Action |
Args |
2012-05-16 10:23:07 | petri.lehtinen | set | recipients:
+ petri.lehtinen, Jiba |
2012-05-16 10:23:07 | petri.lehtinen | set | messageid: <1337163787.68.0.431355112879.issue14828@psf.upfronthosting.co.za> |
2012-05-16 10:23:07 | petri.lehtinen | link | issue14828 messages |
2012-05-16 10:23:07 | petri.lehtinen | create | |
|