Introducing Radical.sh

Forget Code launches a powerful code generator for building API's

Aggregation operation in Pandas

All aggregation operations like min, max, sum, count can be performed pandas data frame or grouped data frame.

Example : Find the min, max , average of age of students
import pandas
data = pandas.DataFrame({'Student Name' : ['Anil', 'Musk','Bill'], 
                        'Class' : [1,2,2], 
                        'Age' : [6, 7, 8 ]})
output = data.groupby(data["Class"])
data.agg({'Age':['min','max','mean','sum','count']}).T


Note : the usage of T operator, it transposes the data frame for SQL like columns.

Output
indexminmaxmeansumcount
Age6.08.07.021.03.0