数据可视化分析笔记
Published in:2020-06-20 |

数据可视化分析

1
2
3
4
5
天气预报-根据拿到的每天的天气情况来绘制可视化图表。
爬虫-拿天气数据-从哪儿拿?(哪个地方没有反爬我们就去哪儿拿)

S
获得到数据之后,使用正则表达式筛选数据
1
2
3
4
5
6
7
8
数据可视化分析,是基于数据的值进行可视化分析的一种手段,我们可以根据可视化中展示的数据,得到一些结论,比如数据是否有明显的趋势、数据的分布是否符合高斯分布(数据的一个体现)
数据的平稳性(数据分析首先对数据进行平稳性分析)
如果是平稳性数据需要分析的时候需要采用:
AR
MA
ARMA
如果是非平稳性数据分析需要采用:
ARIMA

项目要求

采集数据,并且合理的将数据生成HTML进行数据可视化展示。
要求组内每个人都需要至少生成三张图表
不限制一定要天气数据。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# _*_coding:UTF-8 _*_
# 推荐安装pyecharts1.6.0
# pip install pyecharts==1.6.0
# 如果使用pycharm安装,settings中project中 project interpreter点击,
# 点击右方加号,搜索pyecharts点击install即可。
# 如果要指定版本,勾选右下方specify version,选择1.6.0
# 然后在点击install package
# 如果安装成功后,发现版本不对,卸载重装
# 卸载:pip uninstall pyecharts

import requests
import re #正则表达式
import json
from pyecharts.charts import Bar
from pyecharts import options as opts

url1 = 'http://www.weather.com.cn/weather1d/101010100.shtml'# 北京
url2 = 'http://www.weather.com.cn/weather1d/101020100.shtml'# 上海
url3 = 'http://www.weather.com.cn/weather1d/101100101.shtml'# 太原

def get_data(url):
res = requests.get(url=url)
text = res.content.decode('utf-8')
# print(text)
r1 = re.findall('hour3data=(.*?})', text)
r2 = r1[0]
# 使用json把字符串转为字典
r3 = json.loads(r2)
today = r3['7d'][0]
return today

today1 = get_data(url1)# 北京温度
today2 = get_data(url2)# 上海温度
today3 = get_data(url3)# 太原温度

# print([i.split(',')[3] for i in today1])
c = (Bar()
.add_xaxis([i.split(',')[0] for i in today1])
.add_yaxis('北京温度',[int(i.split(',')[3].strip('℃')) for i in today1])# 北京
.add_yaxis('上海温度',[int(i.split(',')[3].strip('℃')) for i in today2])# 上海
.add_yaxis('太原温度',[int(i.split(',')[3].strip('℃')) for i in today3])# 太原
.set_global_opts(title_opts=opts.TitleOpts(title='各城市当天温度'),
toolbox_opts=opts.TitleOpts)
)
c.render('1.html')
Prev:
神经网络实现猫狗识别笔记
Next:
线性回归和逻辑回归学习笔记