I have this dataframe:
id1 | id2 |
---|---|
2341 | qw123 |
2321 | - |
- | de121 |
2341 | qd111 |
And I want to add 3rd column id3
with randomly generated ids in a list:
['11231', '123141', '234512']
The thing that makes it difficult to me is how to attach the same random id from the list to each row where id1
is the same.
For example the output file should look like this:
id1 | id2 | id3 |
---|---|---|
2341 | qw123 | 11231 |
2321 | - | 123141 |
- | de121 | 234512 |
2341 | qd111 | 11231 |
Any solution is appreciated!