From 42b82c67dd3a44329c7186e930e6e3365fba5b17 Mon Sep 17 00:00:00 2001 From: hnu202410040233 <3571724693@qq.com> Date: Sun, 18 May 2025 13:57:32 +0800 Subject: [PATCH] Update README.md --- README.md | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 50 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ce61764..036313e 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,50 @@ -# www.educoder.net - +#https://top.chinaz.com/gongsitop/index_500top. +import requests +import re +import csv +import pandas as pd +import matplotlib.pyplot as plt +url = "https://top.chinaz.com/gongsitop/index_500top.html" +headers = { + "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36" +} +response = requests.get(url, headers=headers) +html = response.text +html +company = re.findall('(.+?)', html) +person = re.findall('法定代表人:(.+?)

', html) +signDate = re.findall('注册时间:(.+?)

', html) +category = re.findall('证券类别:(.+?)

', html) +category +message = [] +for page in range(16): + if page == 0: + url = "https://top.chinaz.com/gongsitop/index_500top.html" + else: + url = "https://top.chinaz.com/gongsitop/index_500top_{}.html".format(page + 1) + response = requests.get(url, headers=headers) + html = response.text + company = re.findall('(.+?)', html) + person = re.findall('法定代表人:(.*?)

', html) + signDate = re.findall('注册时间:(.*?)

', html) + category = re.findall('证券类别:(.*?)

', html) + pageOne = list(zip(company, person, signDate, category)) + message.extend(pageOne) +message +with open("content.csv", "w") as f: + w = csv.writer(f) + w.writerows(message) +!cat content.csv +df = pd.read_csv("content.csv", names=["company", "person", "signDate", "category"]) +df.head() +df.info() +df1 = df.groupby("category").count()["company"] +%matplotlib inline +plt.rcParams['font.sans-serif'] = ['SimHei'] +labels = df1.index +sizes = df1.values +fig1, ax1 = plt.subplots() +ax1.pie(sizes, labels=labels, autopct='%d%%',radius=2,textprops={'fontsize': 20}, + shadow=False, startangle=90) +ax1.axis() +plt.show() \ No newline at end of file