Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to crawl and simply analyze the data of A-share companies with Python

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly explains "how to use Python to crawl and simply analyze A-share company data", interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to crawl and simply analyze the data of A-share companies with Python.

Development tool Python version: 3.6.4 related modules:

Requests module

Bs4 module

Lxml module

Pyecharts module

Wordcloud module

Jieba module

And some modules that come with Python.

Environment building

Install Python and add it to the environment variable, and pip installs the relevant modules you need.

Data crawling

Target website:

Http://www.askci.com/reports/

The data to be crawled is shown below:

Do not bother to think, directly with the help of BeautifulSoup to extract these data, simple and rough, the source code is as follows:

For more information on the complete source code, please see the Spider.py file in the personal home page or private message to get the relevant documents.

The screenshot of the running effect is as follows:

All done~

Data analysis

In the part of data crawling, we have obtained a total of 3573 pieces of A-share company data. Let's simply visually analyze a wave.

First, let's take a look at the regional distribution of A-share companies:

Among them, the provinces with more than 300 A-share companies are:

Guangdong

Beijing

Zhejiang

Jiangsu Province

Next, let's take a look at the income of A-share companies:

Among them, the main business income TOP10 is:

Let's take a look at the number of employees of A-share companies:

Let's take a look at the listing time distribution of A-share companies:

Among them, the lowest number of companies listed in 2013 (2); the largest number of listed companies in 2017 (438).

OK, why don't we take a look at the industry type of A-share companies as a percentage of TOP10:

At this point, I believe you have a deeper understanding of "how to use Python to crawl and simply analyze A-share company data". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report