depend on toolz.groupby, merge