Postgresql Group By Concatenate Python Numpy