The question can be interpreted in multiple ways. The following offers a solution for computing more than one output column, giving the possibility to use a different function for each column.
The example uses the same Pandas DataFrame df as the answer above:
import pandas as pd
df = pd.DataFrame(dict(A=[1,1,2,2,3], B=[4,5,6,7,2], C=[1,2,4,6,9]))
As a function of the groups in A the sum of the values in B is computed and put in one column, and the number of values (count) in B is computed and put in another column.
df.groupby(['A'], as_index=False).agg({'B': {'B1':sum, 'B2': "count"}})
Because dictionaries with renaming will be deprecated in future versions the following code may be better:
df.groupby(['A'], as_index=False).agg({'B': {sum, "count"}})
The next example shows how to do this if you want to have different computations on different columns, for computing the sum of B and mean of C:
df.groupby(['A'], as_index=False).agg({'B': sum, 'C': "mean"})