Created
August 6, 2012 02:01
-
-
Save jobliz/3269061 to your computer and use it in GitHub Desktop.
Piratebay Dataset 2008. Data from http://www.csg.uzh.ch/publications/data/piratebay.html, images at http://imgur.com/a/73RcX
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import csv | |
import pylab as p | |
data = [r for r in csv.reader(open('piratebay.csv', 'rb'))] | |
def categoryratio(c): | |
return sum([ int(r[3]) for r in data if r[1][0] == str(c) ]) | |
# Adapted from # http://scienceoss.com/bar-plot-with-custom-axis-labels/ | |
fig = p.figure() | |
ax = fig.add_subplot(1,1,1) | |
y = map(categoryratio, list(xrange(1, 7))) | |
N = len(y) | |
ind = range(N) | |
ax.bar(ind, y, facecolor='green', align='center', ecolor='black') | |
ax.set_ylabel('Total Seeds') | |
ax.set_title('Piratebay Seeding by Category',fontstyle='italic') | |
ax.set_xticks(ind) | |
group_labels = ['Music', 'Videos', 'Apps', 'Games', 'Porn', 'Other'] | |
ax.set_xticklabels(group_labels) | |
fig.autofmt_xdate() | |
p.show() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import csv | |
import pylab as p | |
data = [r for r in csv.reader(open('piratebay.csv', 'rb'))] | |
def categorysize(c): | |
return sum([int(r[2]) for r in data if r[1][0] == str(c)]) / (2**30) #GiB | |
# Adapted from # http://scienceoss.com/bar-plot-with-custom-axis-labels/ | |
fig = p.figure() | |
ax = fig.add_subplot(1,1,1) | |
y = map(categorysize, list(xrange(1, 7))) | |
N = len(y) | |
ind = range(N) | |
ax.bar(ind, y, facecolor='#777777', align='center', ecolor='black') | |
ax.set_ylabel('GiB') | |
ax.set_title('Piratebay Category Total Size',fontstyle='italic') | |
ax.set_xticks(ind) | |
group_labels = ['Music', 'Videos', 'Apps', 'Games', 'Porn', 'Other'] | |
ax.set_xticklabels(group_labels) | |
fig.autofmt_xdate() | |
p.show() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import csv | |
import matplotlib.pyplot as plt | |
data = lambda: csv.reader(open('piratebay.csv', 'rb')) | |
seeders = [i[3] for i in data()][1:] | |
leechers = [i[4] for i in data()][1:] | |
plt.plot(seeders, leechers, 'ro') | |
plt.xlabel('Number of Seeders') | |
plt.ylabel('Numbers of Leechers') | |
plt.title('Seeders/Leechers ratio') | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment