Python Numpy Aggregate Functions Postgresql Vs Sql