加入收藏 | 设为首页 | 会员中心 | 我要投稿 惠州站长网 (https://www.0752zz.com.cn/)- 办公协同、云通信、物联设备、操作系统、高性能计算!
当前位置: 首页 > 教程 > 正文

Python数据可视化:Python大佬有哪些?

发布时间:2018-12-02 09:13:21 所属栏目:教程 来源:法纳斯特
导读:副标题#e# 有态度地学习 之前讲了代理池以及Cookies的相关知识,这里针对搜狗搜索微信公众号文章的爬取,将它俩实践一下。 在崔大的书里面,他是用代理IP来应对搜狗的反爬措施,因为同一IP访问网页过于频繁,就会跳转验证码页面。 不过时代在进步,搜狗搜索

毕竟信息讲究时效性,如果我搜索获取的都是老掉牙的信息,,就没什么意思了,更何况还是在一直在变化的互联网行业。

  1. import numpy as np 
  2. import pandas as pd 
  3. from pyecharts import Bar 
  4.  
  5. df = pd.read_csv('sg_articles.csv', header=None, names=["title", "article", "name", "date"]) 
  6.  
  7. list1 = [] 
  8. list2 = [] 
  9. for j in df['date']: 
  10.     # 获取文章发布年份及月份 
  11.     time_1 = j.split('-')[0] 
  12.     time_2 = j.split('-')[1] 
  13.     list1.append(time_1) 
  14.     list2.append(time_2) 
  15. df['year'] = list1 
  16. df['month'] = list2 
  17.  
  18. # 选取发布时间为2018年的文章,并对其进行月份统计 
  19. df = df.loc[df['year'] == '2018'] 
  20. month_message = df.groupby(['month']) 
  21. month_com = month_message['month'].agg(['count']) 
  22. month_com.reset_index(inplace=True) 
  23. month_com_last = month_com.sort_index() 
  24.  
  25. attr = ["{}".format(str(i) + '月') for i in range(1, 12)] 
  26. v1 = np.array(month_com_last['count']) 
  27. v1 = ["{}".format(int(i)) for i in v1] 
  28. bar = Bar("微信文章发布时间分布", title_pos='center', title_top='18', width=800, height=400) 
  29. bar.add("", attr, v1, is_stack=True, is_label_show=True) 
  30. bar.render("微信文章发布时间分布.html") 

(编辑:惠州站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

推荐文章
    热点阅读