Fix rowwise groupby in pandas

closes #672