I have a large data set consisting of an ID and a description of pictures associated with that ID. I would like to add a column that counts the pictures based on the description for each id. For example, if id '001' has 4 pictures of garages, I want a column that counts 1,2,3,4 until the ID switches. See example below:
description id
0 garage 001
1 garage 001
2 garage 002
3 garage 003
4 side 001
5 side 002
6 side 002
7 side 003
8 front 003
9 front 001
10 front 001
Expected result:
description id count
0 garage 001 1
1 garage 001 2
2 garage 002 1
3 garage 003 1
4 side 001 1
5 side 002 1
6 side 002 2
7 side 003 1
8 front 003 1
9 front 001 1
10 front 001 2
I will use this later to pivot out each description in columns. I can't pivot them out with out adding a counter and concatenating them.