-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfilter_wanted_repos.py
43 lines (35 loc) · 1.01 KB
/
filter_wanted_repos.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import csv
import pickle
import os
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
wanted_repos = []
with open("repos_count_scratch/repos_count.csv", 'r') as file:
reader = csv.reader(file)
for row in reader:
if len(row) == 0:
continue
if int(row[1]) > 24:
wanted_repos.append(row[0])
if not os.path.exists('final_pickles'):
os.makedirs('final_pickles')
with open('final_pickles/wanted_repos.data', 'wb') as filehandle:
# store the data as binary data stream
pickle.dump(wanted_repos, filehandle)
# Make plot for histogram
"""
repos = []
events = []
with open("repos_count.csv", 'r') as file:
reader = csv.reader(file)
for row in reader:
if len(row) == 0:
continue
repos.append(row[0])
events.append(row[1])
ax = sns.distplot(np.array(events).astype(np.float), kde=False, rug=True)
ax.set_yscale('log')
ax.set(xlabel='N Events in 2015', ylabel='log(N Repositories with N Events)')
plt.show()
"""