I have a large pandas dataframe as below. Need to add two more columns with sales max and min values of the particular brand.
date brand price quantity sales vat
31-May-13 Reebok 10 23 230 3.5
31-May-13 Adidas 10 25 250 2.8
31-May-13 Campus 8 21 168 3.5
31-May-13 Nike 10 20 200 6.5
31-May-13 Woods 2 7 14 2.8
01-Jun-13 Reebok 4 27 108 2.2
01-Jun-13 Adidas 7 28 196 3.8
01-Jun-13 Campus 7 41 287 4.2
01-Jun-13 Nike 2 39 78 7.2
01-Jun-13 Woods 5 26 130 3.3
02-Jun-13 Reebok 10 5 50 2.2
02-Jun-13 Adidas 10 15 150 3.8
02-Jun-13 Woods 6 30 180 3.3
Here my date column is not in order, and all brand data is not available for evey date in the date column. And the result should look like,
date brand price quantity sales vat Max Min
31-May-13 Reebok 10 23 230 3.5 230 50
31-May-13 Adidas 10 25 250 2.8 250 150
31-May-13 Campus 8 21 168 3.5 287 168
31-May-13 Nike 10 20 200 6.5 200 78
31-May-13 Woods 2 7 14 2.8 180 14
01-Jun-13 Reebok 4 27 108 2.2 230 50
01-Jun-13 Adidas 7 28 196 3.8 250 150
01-Jun-13 Campus 7 41 287 4.2 287 168
01-Jun-13 Nike 2 39 78 7.2 200 78
01-Jun-13 Woods 5 26 130 3.3 180 14
02-Jun-13 Reebok 10 5 50 2.2 230 50
02-Jun-13 Adidas 10 15 150 3.8 250 150
02-Jun-13 Woods 6 30 180 3.3 180 14