Crawler re-exploration (v) ——— crawl app data-Super curriculum "two"--word frequency analysis

Source: Internet
Author: User

The previous article has already captured the data, then analyze it. Here is the simple processing of data with Python, followed by the drawing of Excel, yes,, or Excel. In fact, there are better tools for analyzing these data, such as R ... But for the time being, Excel will live with it.

Here are a total of three aspects: TOP10 Word, the relationship between the amount of time and the number of posts, date and number of postings.

    PROJECT1:TOP10 WORD

    Note that the top_words.txt here is that I use XLRD to take out the text and save it in Notepad, and get rid of the punctuation (this shameful process does not show ...). Find a better way to rewrite later)

#!/usr/bin/python#-*-coding:utf-8-*-import xlrdimport xlsxwriterfrom Collections Import Counterwith open (' Top_ Words.txt ', encoding= ' Utf-8 ') as f:# print (F.read ()) L = List (F.read ()) print (l) word_dict = Counter (L). Most_common () # Print (word_dict) workbook = Xlsxwriter. Workbook (' top_words.xlsx ') worksheet = Workbook.add_worksheet () worksheet.set_column (' a:a ', ten) Worksheet.set_column (' B:b ') worksheet.write (0,0, ' keywords ') worksheet.write (0,1, ' frequency ') i = 1num = []for k, v in Word_dict:i + = 1worksheet.write (i, 0,k) Worksheet.write (i,1,v) num.append (v) workbook.close () print (num)

The output Excel table is as follows (part):

Simply make a diagram:

Crawler re-exploration (v) ——— crawl app data-Super curriculum "two"--word frequency analysis

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.