I have a dataframe with below structure,
| Date | Item | Location | Event |
|------------|-------:|----------|---------|
| 01-06-2019 | Item_1 | Loc_1 | Event_1 |
| 01-06-2019 | Item_1 | Loc_1 | Event_1 |
| 02-06-2019 | Item_1 | Loc_1 | Event_1 |
| 02-06-2019 | Item_1 | Loc_1 | Event_2 |
| 02-06-2019 | Item_1 | Loc_2 | Event_2 |
| 02-06-2019 | Item_2 | Loc_1 | Event_3 |
| 03-06-2019 | Item_2 | Loc_1 | Event_3 |
| 03-06-2019 | Item_2 | Loc_1 | Event_3 |
I want to count the number of events occurred with reference to Item + Location in a day. Result as below,
| Date | Item | Location | Event_1 | Event_2 | Event_3 |
|------------|-------:|----------|---------|---------|---------|
| 01-06-2019 | Item_1 | Loc_1 | 2 | 0 | 0 |
| 02-06-2019 | Item_1 | Loc_1 | 1 | 1 | 0 |
| 02-06-2019 | Item_1 | Loc_2 | 0 | 1 | 0 |
| 02-06-2019 | Item_2 | Loc_1 | 0 | 0 | 1 |
| 03-06-2019 | Item_2 | Loc_1 | 0 | 0 | 2 |
Tried pandas pivot_table, could not get the result I want.
Thanks!