I have a pandas DataFrame. I want to calculate sum and average of 2 other columns, based on a value condition in the 1st column, and get results for each group (sum, average) and number of examples in each group.
# quartile value1 value2
# 1 1 0.9
# 1 1 0.8
# 2 1 0.75
# 2 0 0.75
# 3 0 0.5
# 3 0 0.4
# 3 1 0.3
# 4 0 0.1
My desired output should look like:
# quartile value1_sum value2_avg no_of_instances_in_val1
# 1 2 0.85 2
# 2 1 0.75 2
# 3 1 0.40 3
# 4 0 0.10 1
Can anyone help?
