Skip to content

Instantly share code, notes, and snippets.

@mlopatka
Created July 9, 2019 10:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mlopatka/dc1c75015bd5ce27131913517a4bb28b to your computer and use it in GitHub Desktop.
Save mlopatka/dc1c75015bd5ce27131913517a4bb28b to your computer and use it in GitHub Desktop.
parsing and operating the alexa list
import numpy as np
from matplotlib import pyplot as plt
a = []
with open('/Users/mlopatka/Documents/backup_downloads/alexa-top-1m.csv', 'rb') as f:
for line in f:
if len(line) == 43:
print(line)
a.append(len(line)+3)
bins = np.arange(0, 200, 1) # fixed bin size
plt.xlim([min(a)-5, max(a)+5])
plt.hist(a, bins=bins, alpha=0.5)
plt.xlabel('variable X (bin size = 5)')
plt.ylabel('count')
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment