Skip to content
Advertisement

Networkx: Network graph from pandas dataframe

I have the following dataset:

JavaScript

The dataframe shows when different investment firms have invested in the same Company during a year. I want to create a network graph of the Connections between the Firm_ID only. For example Ampersand and BancBoston have both invested in the same company and should therefore be connected. The code I have tried is:

JavaScript

Which generates the following graph: enter image description here

This shows the connections of both Company_ID and Firm_Name. I only want to have the Firms as nodes, where they are connected if they have invested in the same company. I have not found any similar problems or similar datasets where networkx is used. Any help is greatly appreciated!

Advertisement

Answer

Try with merge

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement