Skip to content

Commit 3ce48c6

Browse files
committed
add cod
1 parent 42510ff commit 3ce48c6

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import requests
2+
from pyecharts.charts import Bar
3+
from pyecharts import options as opts
4+
5+
6+
def get_data():
7+
base_url = 'https://api.github.com/search/repositories?q=language:python+created:%3E2019-12-31&sort=stars&order=desc&per_page=10'
8+
response = requests.get(base_url)
9+
result = response.json()
10+
data = {}
11+
for item in result['items']:
12+
data[item['name']] = [item['html_url'], item['stargazers_count'], item['watchers_count'], item['forks']]
13+
return data
14+
15+
16+
def show_img():
17+
data = get_data()
18+
names = list(data.keys())
19+
values = [data[name][1] for name in names]
20+
21+
bar = (
22+
Bar()
23+
.add_xaxis(names[::-1])
24+
.add_yaxis("星标数", values[::-1])
25+
.reversal_axis()
26+
.set_series_opts(label_opts=opts.LabelOpts(position="right"))
27+
.set_global_opts(
28+
yaxis_opts=opts.AxisOpts(name_rotate=0, name="项目", axislabel_opts={'interval': -10, "rotate": 0}),
29+
title_opts=opts.TitleOpts(title="2020 GitHub Python TOP 10"))
30+
)
31+
bar.render_notebook()
32+
33+
34+
if __name__ == '__main__':
35+
show_img()

doudou/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
Python技术 公众号文章代码库
44

5+
### 2020 代码列表
6+
57
+ [douban-movie-top250](https://github.com/JustDoPython/python-examples/tree/master/doudou/2020-02-20-douban-movie-top250):实战|数据分析篇之豆瓣电影 TOP250
68
+ [duo-la-a-meng](https://github.com/JustDoPython/python-examples/tree/master/doudou/2020-03-27-duo-la-a-meng):用 Python 画哆啦 A 梦
79
+ [fund-fixed-investment](https://github.com/JustDoPython/python-examples/tree/master/doudou/2020-03-27-found):指数基金定投到底能不能赚钱?Python 来告诉你答案
@@ -18,6 +20,9 @@ Python技术 公众号文章代码库
1820
+ [163 music](https://github.com/JustDoPython/python-examples/tree/master/doudou/2020-11-02-163-music):下载网易云乐库
1921
+ [Chinese People's Volunteer Army](https://github.com/JustDoPython/python-examples/tree/master/doudou/2020-11-10-resisting-us-aid-korea):中国人民志愿军
2022

23+
### 2021 代码列表
24+
+ [GitHub-Top10](https://github.com/JustDoPython/python-examples/tree/master/doudou/2021-01-02-GitHub-Python-Top10):2020-GitHub-Python-Top10
25+
2126
---
2227

2328
从小白到工程师的学习之路。

0 commit comments

Comments
 (0)