From 8b544bc0f0f3d499e1afea7109c6fe96fde49423 Mon Sep 17 00:00:00 2001 From: hnu202111020218 Date: Fri, 31 Dec 2021 21:17:58 +0800 Subject: [PATCH] Update README.md --- README.md | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 40a859e..8ee682a 100644 --- a/README.md +++ b/README.md @@ -9,15 +9,14 @@ html = response.text #print(html) parse = etree.HTMLParser(encoding='utf-8') doc = etree.HTML(html) -#states states = doc.xpath('//div[@class="table_container"]//tbody/tr/td/span/text()') -print(states) +#print(states) person = doc.xpath('//div[@class="table_container"]//tbody/tr/td[2]/text()') -print(person) +#print(person) person = [x.replace(",", "") for x in person] -print(person) +#print(person) death = doc.xpath('//div[@class="table_container"]//tbody/tr/td[3]/text()') -print(death) +#print(death) death = [x.replace(",", "") for x in death] message = list(zip(states, person, death)) import csv @@ -29,12 +28,12 @@ import pandas as pd #读取数据 df = pd.read_csv("content.csv", names=["states", "person", "death"],encoding = 'gb2312') df.head() -print(df) +#print(df) for i in range(101): df.drop([i],inplace=True) -print(df) +#print(df) df.sort_values(by=['person'],ascending=False) -print(df) +#print(df) df=df.iloc[0:158] print(df) import matplotlib.pyplot as plt @@ -46,4 +45,3 @@ plt.bar(x, y) plt.xlabel("states") plt.ylabel("person") plt.show() -