全国各地aqi空气质量数据,时间从2014到2020年,基本包括全国各地所有监测站点,包括pm2.5,pm10,co,so2等
2021-10-26 09:49:32 67B pm2.5 空气质量
1
from lxml import etree import urllib import urllib.request import xlwt import pandas as pd from pyecharts import Geo import matplotlib.pyplot as plt import matplotlib as mpl def getpage(url): req=urllib.request.Request(url) req.add_header('User-Agent') #添加自己的用户代理 data=urllib.request.
2021-10-26 08:15:53 169KB python爬虫 可视化 大数据
1
爬取空气质量检测网的部分城市的历年每天质量数据 思路----------------------------------------- 从某城市的空气质量网页获取某市每月的链接,再爬取每个月的表格数据。连云港市:https://www.aqistudy.cn/historydata/daydata.php?city=连云港 连云港2014年5月的空气质量:https://www.aqistudy.cn/historydata/daydata.php?city=连云港&month=2014-05 遇到的问题----------------------------------------- 获取的网页中的表格数据隐藏,尝试requests无法获取。判断可能是动态加载的网页 尝试----------------------------------------- 1. 通过XHR,js查找隐藏数据的加载网页,没有找到。 2. 使用phantomjs.get() result=pd.read_html ,可以获得隐藏的表格数据,但是并不稳定,只是偶尔出现加载的表格数据,无法大规模的获取 解决方法----------------------------------------- 查找资料得知这个网站的表格数据在Console里的items中, 使用selenium的webdriver.firefox(),driver.execute_script("return items") 数据可获得。 仍遇到的问题:----------------------------------------- 爬取一个网页可获得数据,但是连续的获取网页,会出现两个错误。 1.Message: ReferenceError: items is not defined 2.connection refused 解决方法: 1.connection refused问题,可能是网页开太多,使用driver.quit() 2. 如果 execute_script 还是出错,可尝试pd.read_html获取信息。之前用phantomjs获取的时候输出空的表格,可能由于加载不够,用 Waite直到table出现之后再获取网页 Element=wait.until(EC.element_to_be_clickable((By.XPATH,"/html/body/div[3]/div[1]/div[1]/table/tbody"))) 3.之后出现偶尔出现输出为空,使用循环,如果输出表格为空,再重新获取。 if len(result)>1: filename = str(month) + '.xls' result.to_excel('E:\python\案例程序\data\\' + filename) print('成功存入'+filename) driver.quit() else: driver.quit() return getdata(monthhref,month)
2021-09-25 17:58:56 12KB 爬空气质量数据
1
SSRS,中国空间数据地图,官方下载地址为:http://www.diva-gis.org/gData
2021-08-28 20:30:43 29.82MB SSRS 中国空间数据地图
1
2021年全国空气质量监测站点列表(含经纬度).zip
2021-08-18 13:19:16 111KB 空气质量
含AQI、PM2.5、PM2.5_24h、PM10、PM10_24h、SO2、SO2_24h、NO2、NO2_24h
2021-08-18 13:19:14 46.05MB 空气质量
含AQI、PM2.5、PM2.5_24h、PM10、PM10_24h、SO2、SO2_24h、NO2、NO2_24h
2021-08-18 13:19:14 44.71MB 空气质量
含AQI、PM2.5、PM2.5_24h、PM10、PM10_24h、SO2、SO2_24h、NO2、NO2_24h
2021-08-18 13:19:13 42.25MB 空气质量
含AQI、PM2.5、PM2.5_24h、PM10、PM10_24h、SO2、SO2_24h、NO2、NO2_24h
2021-08-18 13:19:13 41.97MB 空气质量
含AQI、PM2.5、PM2.5_24h、PM10、PM10_24h、SO2、SO2_24h、NO2、NO2_24h
2021-08-18 13:19:12 44.75MB 空气质量