title: storing and retrieving connections between elements in pandas dataframe
body: <p>I have a pandas dataframe where I would like to store and retrieve connection information between different elements. As shown in the pic below, each entry in a column is connected to one or more entries in the subsequent column. While most connections are one-on-one (red), is a small hand full of cases, one element could be linked to two or vice versa(green). I have dataframe with many hundreds of columns and I am not sure what's the best way to save these connections. My current approach is to extract only the second kind of connections (green) and save them in a separate dataframe it would be helpful to have all these connections saved.<a href="https://i.stack.imgur.com/Rr4wh.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Rr4wh.png" alt="enter image description here" /></a></p>