Search code examples
csvpagerankgraphlab

How to export the result of pagerank as csv file to the disk in GraphLab Create?


Hello I was reaing this tutorial written by Shawn about getting started on GraphLab Create right here

http://graphlab.com/learn/notebooks/getting_started_with_graphlab_create.html#

which is really helpful.

And I got a question that how to export the result of pagerank as csv file to the disk?

Thanks ahead!


Solution

  • The following example is given in the API docs.

    >>> g = graphlab.load_graph('http://snap.stanford.edu/data/email-Enron.txt.gz', format='snap')
    >>> pr = graphlab.pagerank.create(g)
    >>> pr_out = pr['pagerank'] 
    

    That final SFrame, pr_out, can be saved as a csv file as follows:

    pr_out.save('pagerank_values.csv', format='csv')