# -*- coding: utf-8 -*-
"""
Created on Thu Sep 27 10:06:17 2018
@author: JUSTi
"""
import urllib3
from pyecharts import Geo
import pandas as pd
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
def scratch(url):
http = urllib3.PoolManager()
response = http.request('GET',url)
data = response.data.decode('UTF-8')
return data
def depict(url):
tables = pd.read_html(url)
df = pd.DataFrame(tables[0])
city = []
degree = []
df.to_html("table")
for i in range(1,df.shape[0]):
ct = df[5][i]#城市
deg = df[0][i]
dep = df[4][i]
d = []
d.append(deg)
d.append(dep)#震级和深度
city.append(ct)
degree.append(d)
geo = Geo("地震图", "数据来源:中国地震台网", title_color="#fff",title_pos="center",width=1000,height=600, background_color='#404a59')
geo_cities_coords={df[5][i]:[df[3][i],df[2][i]]for i in range(1,df.shape[0])} #自定义经纬度
g
【Python】中国地震网数据抓取
最新推荐文章于 2025-07-05 15:34:37 发布