this is my first question here so please excuse me for any formatting errors.
I have a dataframe that let's say looks like this
ID | Contact | First Name | Last Name
1 | A | Joe | Doe
1 | B | Jane | Doe
2 | C | Peter | Parker
2 | D | Iron | Man
And I want to iterate through the dataframe and create a dictionary so I get results such as:
{1:{A:[Joe, Doe]}, {B:[Jane, Doe]}, 2:{C:[Peter, Parker]},{D:[Iron, Man]}}
I'm using pandas to create the dataframe and I've been struggling with this for a while, maybe I'm too far down the rabbithole and the answer is rather easy or something different from what I've already tried.
I tried using a for loop to iterate through the contacts and then checking if the ID repeated and then grouping them together but it didn't work.
Thanks in advance for any help.