I had a list of input something like:
A1A
B1A
C2D
B1A
D3C
B2D
...
and I wish to output a pivot table like:
| 1A | 3C | 2D | |
|---|---|---|---|
| A | 1 | ||
| B | 2 | 1 | |
| C | 1 | ||
| D | 1 |
The list first character as row name and count the individual remaining character.
I was trying to transform the list into dic format first
input = ['A1A', 'B1A', 'C2D', 'B1A', 'D3C', 'B2D']
dict_r = {}
for id in input:
result.setdefault(id[0], []).append(id)
and I have no idea what I can do for next.