I am trying to build a dynamic network, using NetworkX, of B2C-companies and their suppliers. My data looks like this (in Pandas). It is indexed by the company ID:
+---------+---------------------+
| Company | Supplier |
+---------+---------------------+
| Firm A | {sup1, sup2, sup 3} |
| Firm B | {sup1, sup2} |
| Firm C | {sup1, sup3} |
+---------+---------------------+
Now, if there is more than one supplier per firm, I want to create n-1 new rows just underneath the original one. My desired output would look like this:
+---------+----------+
| Company | Supplier |
+---------+----------+
| Firm A | sup1 |
| Firm A | sup2 |
| Firm A | sup3 |
| Firm B | sup1 |
| Firm B | sup2 |
| Firm C | sup1 |
| Firm C | sup3 |
+---------+----------+
I also want to eliminate the curly brackets.