I am trying to do a cross tab based on one column where a third column matches. Take the example data:
df = pd.DataFrame({'demographic' : ['A', 'B', 'B', 'A', 'C', 'C'],
'id_match' : ['101', '101', '201', '201', '26', '26'],
'time' : ['10', '10', '16', '16', '1', '1']})
where id_match matches i want to find the resulting sum of of the time for the cross tab of the demographic column. The output would look like this:
A B C
A 0 52 0
B 52 0 0
C 0 0 2
Hopefully that makes sense, comment if not. Thanks J