Statistical analysis
We can easily find some information from our Facebook graph, such as the number of friends and individual data of each one. However, there are many questions that we can't get directly from the site, such as male to female ratio, 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 male to female ratio, because we already have the gender value in the GDF file obtained from Netvizz.
Tip
For simplicity in the code examples, we will split the myFacebookNet.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 file nodes.csv
will look as follows:
nodedef>name VARCHAR,label VARCHAR,gender VARCHAR,locale VARCHAR,agerank INT 23917067,Jorge...