data = """
Month    Fruit   Sales  Revenue
1       Apple    45     45
1       Bananas  12     12
1       Apple    16     16
3       Apple    6      6
1       Kiwi     34     34
3       Bananas  6      6
12      Melon    12     12
"""
df = pd.read_csv(StringIO(data), sep='\\s+')
Pandas: aggregate based on filter on another column