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