Python Numpy Aggregate Functions Postgresql Version