From the course: Applied AI for Human Resources

Unlock the full course today

Join today to access over 24,700 courses taught by industry experts.

Creating and visualizing networks

Creating and visualizing networks - Python Tutorial

From the course: Applied AI for Human Resources

Creating and visualizing networks

- [Instructor] Having created employee pair summaries, we will now create a network from this data and visualize it. Creating a NetworkX network is straightforward. We create a graph with the Graph method, then we iterate over each of the records in the employee pairs DataFrame. For each record, we add an edge with the first name as origin, the second name as destination, and the count as the weight of the edge. The nodes will automatically be identified and added to NetworkX. We then print the summary of the network. Let's run this code and review the results. We see that the network has nine nodes and 25 edges. This nine is equal to the total number of employees we have in the dataset. Now, let's visualize this network. In order to have better visualization, we want to differentiate the edges based on the count of times the pair of employees appeared in the chat group. So we split the pairs into three datasets…

Contents