I'm trying to reshape my pd dataframe with the following function:
ar = ar.pivot(index='Received', columns='Merch Ref', values='acceptance_rate')
The dataset looks like:
Merch Ref Received acceptance_rate
0 SF 2014-08-28 15:38:00 0
1 SF 2014-08-28 15:44:00 0
2 SF 2014-08-28 16:04:00 0
3 WF 2014-08-28 16:05:00 0
4 WF 2014-08-28 16:07:00 0
5 SF 2014-08-28 16:34:00 0
6 SF 2014-08-28 16:55:00 0
7 BF 2014-08-28 17:59:00 0
8 BF 2014-08-29 15:05:00 0
9 SF 2014-08-29 21:25:00 0
10 SF 2014-08-30 10:29:00 0
...
What I'd like to obtain is:
SF WF BF
2014-08-28 15:38:00 0 1 0
2014-08-28 15:44:00 0 1 0
2014-08-28 16:04:00 0 0 1
2014-08-28 16:05:00 1 1 0
2014-08-28 16:07:00 0 0 1
2014-08-28 16:34:00 1 1 0
2014-08-28 16:55:00 1 1 0
2014-08-28 17:59:00 0 1 0
2014-08-29 15:05:00 0 0 1
2014-08-29 21:25:00 0 0 1
2014-08-30 10:29:00 0 1 0
However, I get the error:
ValueError: Index contains duplicate entries, cannot reshape
This is because i have some orders placed at the same time. Is there a way to sum/aggregate these orders ?