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 value of the nodes.csv
file and get the male to female ratio in a pie chart visualization.
The nodes.csv
file will look like this:
nodedef>name VARCHAR,label VARCHAR,gender VARCHAR,locale VARCHAR,agerank INT 23917067,Jorge,male...