Skip to content

Commit 715b313

Browse files
committed
Merge branch 'data_analysis'
2 parents 273797c + 0787bec commit 715b313

18 files changed

Lines changed: 30574 additions & 2 deletions

.DS_Store

10 KB
Binary file not shown.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@
77

88
>作者:liuzhijun
99
>微信: lzjun567
10-
>公众号:一个程序员的微站(id:VTtalk)
10+
>公众号:Python之禅(id:VTtalk)

blog/testt.py

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# encoding: utf-8
2+
__author__ = 'liuzhijun'
3+
4+
import urllib.request as urllib
5+
6+
from collections import deque
7+
def cache(func):
8+
saved = {}
9+
10+
def wrapper(url):
11+
if url in saved:
12+
return saved[url]
13+
else:
14+
page = func(url)
15+
saved[url] = page
16+
return page
17+
18+
return wrapper
19+
20+
21+
def web_lookup(url, saved={}):
22+
if url in saved:
23+
return saved[url]
24+
page = urllib.urlopen(url).read()
25+
saved[url] = page
26+
return page
27+
28+
29+
@cache
30+
def web_lookup(url):
31+
return urllib.urlopen(url).read()
32+
33+
34+
def main():
35+
import jieba
36+
seg_list = jieba.cut("最实用的微信小程序大全,持续更新中...", cut_all=False)
37+
print("Default Mode: " + "/ ".join(seg_list)) # 精确模式
38+
39+
40+
if __name__ == '__main__':
41+
main()

juejin/anay.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import pandas as pd
2+
3+
tags_df = pd.read_csv('D:/my/crawler_html2pdf/juejin/tag.csv')
4+
5+
languages = ['Java', 'Python', 'Ruby', 'Swift', 'Go', 'Dart', 'Objective-C', 'C', 'C++', 'C#', 'PHP', 'JavaScript',
6+
'Perl', 'VB', 'R', 'MATLAB', 'Groovy', "Scala"]
7+
8+
lang_tags_df = tags_df[tags_df["title"].isin(languages)]
9+
10+
lang_tags = lang_tags[['title', 'viewsCount']]
11+
lang_tags.drop(177, axis=0, inplace=True)
12+
13+
rules = {'前端': 'JavaScript'}
14+
lang_tags['title'].replace(rules, inplace=True)
15+
16+
titles = lang_tags.ix[:, 0].values
17+
18+
lang_tags.set_index(titles, inplace=True)
19+
lang_tags.drop('title', inplace=True, axis=1)
20+
print(lang_tags)
21+
lang_tags.to_csv("xx.csv")
22+
lang_tags.plot.pie(subplots=True, figsize=(8, 4))
23+
24+
#
25+
# import cufflinks as cf
26+
#
27+
# cf.set_config_file(world_readable=True,offline=False)
28+
#
29+
# pie = cf.datagen.pie()
30+
# pie.head()
31+
32+
33+
jd = ["前端", "后端", "Android", "iOS", "设计", "产品", "测试", "运营"]

0 commit comments

Comments
 (0)