so my df looks like that:
task | feature | activity |
---|---|---|
a | e | 1 |
d | 2 | |
f | 3 | |
e | 4 | |
d | 5 | |
f | 6 | |
e | 7 | |
d | 8 | |
f | 9 | |
e | 10 | |
d | 11 | |
f | 12 | |
-------- | -------- | -------- |
b | e | 13 |
d | 14 | |
f | 15 | |
e | 16 | |
d | 17 | |
f | 18 | |
e | 19 | |
d | 20 | |
f | 21 | |
e | 22 | |
d | 23 | |
f | 24 |
and I want it to look like that:
task | e | d | f |
---|---|---|---|
a | 1 | 2 | 3 |
4 | 5 | 6 | |
7 | 8 | 9 | |
10 | 11 | 12 | |
-------- | -------- | -------- | --------- |
b | 13 | 14 | 15 |
16 | 17 | 18 | |
19 | 20 | 21 | |
22 | 23 | 24 |
the numbers and letters here are just for example, in the real df the characters are different and the numbers are random.
I tried using pivot but got this message:
ValueError: Index contains duplicate entries, cannot reshape
and then I tried pivot_table() but the whole point is that I don't want to aggregate.
I'd be happy to know if there is a solution for that. Thanks!