Giter VIP home page Giter VIP logo

linwinfan / zhihu_bigdata Goto Github PK

View Code? Open in Web Editor NEW

This project forked from yoghurtjia/zhihu_bigdata

0.0 2.0 0.0 21.49 MB

使用scrapy和pandas完成对知乎300w用户的数据分析。首先使用scrapy爬取知乎网的300w,用户资料,最后使用pandas对数据进行过滤,找出想要的知乎大牛,并用图表的形式可视化。

Python 1.57% HTML 65.36% Jupyter Notebook 33.06%

zhihu_bigdata's Introduction

overview

使用scrapy和pandas完成对知乎300w用户的数据分析。首先使用scrapy爬取知乎网的100w,用户资料,
最后使用pandas对数据进行过滤,找出想要的知乎大牛,并用图表的形式可视化。
#requirments: os:win7 64bit
scrapy:1.0
python:2.7.10
anaconda:安装这个,可以使用里面的ipython notebook #use 1.由于知乎网需要登录,所以如果想要使用这个爬虫,需要有一点scrapy基础。scrapy登陆的时候需要自己的知乎账号和密码,请修改
zhihu\zhihu\spiders\zhihu_spider.py,里面的 : formdata =
{ '_xsrf': xsrf,#不需要修改
'email': '[email protected]', #改成自己知乎登陆账号
'password': 'abc'#改成自己的密码
},
2.下载文件夹到自己的电脑上,打开windows,cmd,cd zhihu:
scrapy crawl zhihu -o user.json(生成一个user.json文件,里面包含我们需要的用户信息: json有将近300w条用户信息。每一条的组成结构如下所示:
url #用户主页地址
aggree_count #用户获得的赞同数(越多越牛) thanks_count #用户得到的感谢数(越多越牛)
name #用户名字
most_good_topic #最感兴趣的话题
##关于爬虫方面的疑问,请参考这个链接:
使用scrapy模拟登陆知乎
##使用pandas对user.json进行数据分析,以及可视化。 关于这部分的代码,我全部放在'使用pandas对数据进行分析'这个文件下,只要计算机上安装了ipython notebook,就可以打开,重现计算结果,也可以直接打开里面的.html文件。

zhihu_bigdata's People

Contributors

yoghurtjia avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.