-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexcel_reader.py
More file actions
37 lines (34 loc) · 1.09 KB
/
Copy pathexcel_reader.py
File metadata and controls
37 lines (34 loc) · 1.09 KB
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
import pandas
from model import Repo
def get_repos_from_excel(file, sheet):
"""
input: path and sheet name of an excel file containing
a column called "name" with <user>/<repo-name> on each entry
output: list of <user>/<repo-name>
"""
df = pandas.read_excel(file, sheet_name=sheet)
names = df["name"]
commits = df["commits"]
releases = df["releases"]
contributors = df["contributors"]
forks = df["forks"]
watchers = df["watchers"]
stargazers = df["stargazers"]
createdAt = df["createdAt"]
updatedAt = df["updatedAt"]
repos = []
for i in range(len(df)):
repos.append(
Repo(
names[i],
num_commits=str(commits[i]),
num_releases=str(releases[i]),
num_contributors=str(contributors[i]),
num_watchers=str(watchers[i]),
num_forks=str(forks[i]),
num_stargazers=str(stargazers[i]),
created_at=str(createdAt[i]),
updated_at=str(updatedAt[i])
)
)
return repos