-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
74 lines (48 loc) · 1.78 KB
/
main.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import requests
# import pandas as pd
url = 'https://github.com/gitapi/search/repositories?q=language:python&sort=stars&order=desc'
res = requests.get(url)
res_dict = res.json()
repos = res_dict ["items"]
len(repos)
import requests
import pandas as pd
url = 'https://github.com/gitapi/search/repositories?q=language:python&sort=stars&order=desc'
res = requests.get (url)
res_dict = res. json ( )
repos = res_dict[ 'items']
len (repos)
30
del res_dict['items']
res_dict
{'incomplete_results': True,'total count': 8046758}
repo_df = pd.DataFrame(repos)
repo_df = repo_df[['name', 'full_name', 'html_url', 'created_at', 'stargazers_count', 'watchers', 'forks', 'open_issues']]
repo_df['created_at'] = pd.to_datetime(repo_df['created_at'])
repo_df['created_year'] = repo_df['created_at'].dt.year
repo_df['years_on_github'] = 2022 - repo_df['created_at'].dt.year
repo_df = pd. DataFrame (repos)
repo_df = repo_df[['name', 'full _name', 'html _url', 'created at', 'stargazers_ count', 'watchers', 'forks', 'open_issues']]
repo_df['created_at'] = pd.to_datetime(repo_df['created_at'])
repo_df ['created _year'] = repo_df['created_at'].dt.year
repo_df['years _on_github'] = 2022 - repo_df['created_at'].dt.year
repo_df
# import requests
# import pandas as pd
#
# url = 'https://github.com/gitapi/search/repositories?q=language:python&sort=stars&order=desc'
#
# res = requests.get(url)
# res_dict = res.json()
#
# repos = res_dict["items"]
# len(repos)
#
# repo_df = pd.DataFrame(repos)
#
# repo_df = repo_df[['name', 'full_name', 'html_url', 'created_at', 'stargazers_count', 'watchers', 'forks', 'open_issues']]
# repo_df['created_at'] = pd.to_datetime(repo_df['created_at'])
# repo_df['created_year'] = repo_df['created_at'].dt.year
# repo_df['years_on_github'] = 2022 - repo_df['created_at'].dt.year
#
# repo_df