I have a dataset that contains ID
and Address
associated with the ID
. An example would be:
ID Address
1001 123 E example rd, 12300
1001 123 E example rd, 12300
1001 456 W example rd, 45600
1002 789 N example rd, 78900
1002 123 E example rd, 12300
1003 789 N example rd, 78900
1004 456 W example rd, 45600
1004 789 N example rd, 78900
1004 789 N example rd, 78900
1004 123 E example rd, 12300
Now, in the above example, we have 3 unique ID's. I want to label them as Place 1, Place 2 and Place 3. Finally, I want to have a data structure as below:
ID x1 x2 x3 x4
1001 Place 1 Place 1 Place 2
1002 Place 3 Place 1
1003 Place 3
1004 Place 2 Place 3 Place 3 Place 1
Since in my real dataset I have around 3000 unique addresses, I am looking for code that can loop around and label all 3000 addresses from Place 1 to Place 3000.