Use Python to analyze the gender and location of WeChat friends and python gender

Source: Internet
Author: User

Use Python to analyze the gender and location of friends and python gender

A very interesting library is used today --ItchatIt has completed wechat's personal account API, making it easier to crawl personal information.

Download

Crawl friend information

In this way, all your friends are returned. We do not need so much information. We choose to store some information to a csv file.

Note: The returned information is a list. The first one is my own information, so it starts from the second item.

Stored files

2: female, 1: male, 0: Others

Next, we will analyze the data in the csv file.

First, let's look at the gender distribution of friends:

I used the Echarts chart here and stole a lazy

I still have a large proportion of male, which is normal.

Next, we will analyze the location of friends.

Echarts display

This bar chart intuitively shows the distribution of friends.

This article only uses a small feature of itchat. It also has many interesting features, such as automatic reply to information, automatic addition of friends, and management groups, all of which are waiting for you to actively explore.

 

Reprint | Source: http://t.cn/R8Ljkir

Related Article

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.