Statistical analysis

We can easily find information, such as the number of friends and individual data of each one, from our Facebook graph. However, there are many answers that we can't get directly from the site, for example, male to female ratio or How many of my friends are Republicans?, or who is my best friend?; these questions can be easily answered with a few lines of code and some basic statistical analysis. In this chapter, we will start with the male to female ratio, because we already have the gender value in the .gdf file.

Tip

For simplicity in the code examples, we will split the friends.gdf file into two CSV files—one for the nodes (nodes.csv) and one for the links (links.csv).

Male to female ratio

In this example, we will use the gender ...

Get Practical Data Analysis - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.