随机生成数据*
data = []
for date in dates:
for time in times:
for road in roads:
num_vehicles = np.random.randint(100, 500) # 车辆数目
signal_cycle = np.random.randint(60, 120) # 信号灯周期
avg_speed = np.random.randint(30, 60) # 平均车速
accidents = np.random.randint(0, 3) # 交通事故数量
data.append([date, road, time, num_vehicles, signal_cycle, avg_speed, accidents])模拟了一个包含多个道路、多个时段、多个日期的交通数据集。
roads、times 和 dates 定义了数据的维度,而每条记录表示在某个时间段、某个道路上的交通情况。
num_vehicles、signal_cycle、avg_speed 和 accidents 分别模拟了该时段该路段的车辆数量、信号灯周期、平均车速和交通事故数。
road_summary = df.groupby(['日期', '道路', '时间段']).agg({
'车辆数目': 'sum',
'平均车速': 'mean',
'交通事故数': 'sum',
'交通事故率': 'mean'}).reset_index()
交通事故率:这里计算了每条记录的交通事故率,即 交通事故数 / 车辆数目,这一指标能有效反映事故的频发程度。
聚合数据:按日期、道路和时间段对数据进行分组,并对每个组别进行汇总:
sum:对 车辆数目 和 交通事故数 进行求和。
mean:对 平均车速 和 交通事故率 计算均值。
最终得到的 road_summary DataFrame 包含了按道路、时间段和日期汇总的车流量、车速、事故数等信息。
4.5 信号灯周期与车流量的关系曲线图
plt.figure(figsize=(10, 6))
sns.scatterplot(data=df, x='信号灯周期', y='车辆数目', hue='道路', style='时间段')
plt.title('信号灯周期与车流量之间的关系')
plt.xlabel('信号灯周期 (秒)')
plt.ylabel('车辆数目')
plt.legend(title='道路')
plt.tight_layout()
plt.savefig('signal_cycle_traffic_flow.png') # 保存为PNG文件
plt.close()
绘制了信号灯周期与车辆数目之间的散点图。
每个点代表一个记录,hue='道路' 按道路分色,style='时间段' 按时间段区分点的样式。
生成PDF报告*
def generate_pdf_report():
c = canvas.Canvas("analysis_report.pdf", pagesize=letter)
width, height = letter
c.drawString(30, height - 140, "2. 数据分析:")
c.drawString(30, height - 160, " - 按道路和时间段汇总数据,计算了车流量、车速和交通事故率。")
c.drawString(30, height - 180, " - 发现高峰时段和高事故率区域。")
c.drawString(30, height - 200, "3. 优化建议:")
c.drawString(30, height - 220, " - 在高流量时段适当延长信号灯周期。")
c.drawString(30, height - 240, " - 在事故高发区域加强交通管理。")
使用 reportlab 库创建了一个 PDF 报告。
报告包含标题、分析过程、优化建议和图表。
图表通过 drawImage 方法嵌入到 PDF 中。
最终报告被保存为 analysis_report.pdf
generate_pdf_report()
# 7. 提供优化建议
high_accident_areas = road_summary[road_summary['交通事故率'] > 0.01]
peak_traffic_times = road_summary[road_summary['车辆数目'] > 400]
print("高风险事故区域(事故率 > 1%):")
print(high_accident_areas[['日期', '道路', '时间段', '交通事故率']])
print("\n高峰时段交通流量:")
print(peak_traffic_times[['日期', '道路', '时间段', '车辆数目']])
根据分析结果,提供了两种优化建议:
高风险事故区域(事故率大于 1%),需要加强交通管理。
高峰时段交通流量较大,可能需要调整信号灯周期等交通控制措施。
# 假设建议:在高流量时段适当延长信号灯周期,并且在事故高发区域加强交通管理。





复制粘贴
效果如图

注意 :一定要看清楚和修改分支不然就会有问题]]>
# electric_clock
# see https://blog.anheyu.com/posts/fc18.html
electric_clock:
enable: true # 开关
priority: 5 #过滤器优先权
enable_page: all # 应用页面
exclude:
# - /posts/
# - /about/
layout: # 挂载容器类型
type: class
name: sticky_layout
index: 0
loading: https://cdn.cbd.int/hexo-butterfly-clock-anzhiyu/lib/loading.gif #加载动画自定义
clock_css: https://cdn.cbd.int/hexo-butterfly-clock-anzhiyu/lib/clock.min.css
clock_js: https://cdn.cbd.int/hexo-butterfly-clock-anzhiyu/lib/clock.min.js
ip_api: https://widget.qweather.net/simple/static/js/he-simple-common.js?v=2.0
qweather_key: # 和风天气key
gaud_map_key: # 高得地图web服务key
default_rectangle: false # 开启后将一直显示rectangle位置的天气,否则将获取访问者的地理位置与天气
rectangle: 112.982279,28.19409 # 获取访问者位置失败时会显示该位置的天气,同时该位置为开启default_rectangle后的位置然后注意要对好格式不然就要像我一下像一个无头苍蝇一样到处找最重要的还是
qweather_key: # 和风天气key
gaud_map_key: # 高得地图web服务key
这两个一定要配置不然也显示不了
具体教程还是看https://blog.anheyu.com/posts/fc18.html
写的很详细我这里就不多说了
最后hexo s或 hexo clean && hexo g && hexo s就行
样式

我这里已经创建了一个


参考其他博主 https://www.dujin.org/22073.html
教程视频参考云凡博主 https://www.bilibili.com/video/BV1fz421m718/?spm_id_from=333.1007.top_right_bar_window_history.content.click&vd_source=4d1859c2276cb6ea0f2afc467eaf7c7c
前言
近些年来很多用户都喜欢使用 GitHub 来搭建 Hexo 静态博客网站,其最吸引人的莫过于完全免费使用,并且非常稳定。
虽然搭建时比较麻烦,有点折腾,但是配置完成后,基本不需要操心维护的事,甚至放了几年都忘记了,打开来看文章依然还在。
由于博主比较懒所以可能大部分都是参考别人的文章
我这里偷懒一下哈哈这个博主写的比较详细
https://zhuanlan.zhihu.com/p/443527549
安装完成之后打开git hexo v 一下就会显示版本号说明安装成功了![Y0T<code>Q0R1NBH1FEN__]O</code>UTW.png Y0T<code>Q0R1NBH1FEN__]O</code>UTW.png](/usr/uploads/2024/05/3550106947.png)
注册一个GitHub账号可以看看这个博主的文章
https://blog.csdn.net/m0_67906358/article/details/128808210
然后连接git GitHub可以看看这篇文章
https://zhuanlan.zhihu.com/p/370635512
之后就可以开始部署hexo了
https://go2think.com/build-blog-with-hexo-on-github-pages/
最后直接hexo s就可以了
然后就不要动了CTRL+C会停止运行可以选中然后右键有了copy复制打开就行


我是加了butterfly主题感兴趣的可以去搜一下还是一个比较好的主题
基本上全部都部署完成了有不动的可以加我p 备注一下什么问题我可以帮你看一下当然能自己解决更好哈哈
本期内容就到此结束了下期再见!
如有侵权请告诉我,我立马改正!
我的情况跟博主差不多去年开始做博客,我很庆幸刚刚开始还有大佬带着教我一下常用的知识但是因为种种原因大佬比较忙现在自己慢慢研究,记得刚刚开始看代码的时候一头雾水


但是静下心来慢慢看还是可以看到,我常常在思考为什么要写博客有什么作用意义在哪?
看到这篇文章我知道了找到了自己,第一是为了提升自己的能力第二就是为了更好的学习吧
生命不息,奋斗不止
做人如果没有理想,跟咸鱼有什么区别出自《少林足球》-- 周星驰
是啊刚刚开始只是想着做一个网站写一些好的文章现在实现了想想道路还是很艰难的
就一个花瓣效果我就改了两天当成功的时候还是很开心的因为我做到了
我认为应该勇于挑战自己的极限来提升自己的实力
别去羡慕别人有什么那还不如自己努力来的实在
因为你只看到他成功了没有看到背后努力的过程
人们通常只看结果不看过程成为了普遍现象
相信在未来的自己再看到这篇文章时一定会感慨当时做的决定
总有人要赢,为什么不能是我!
加油相信自己一定可以!


他是直接添加在PHP里面但是有时候可能加载不出来要耐心等待一下因为我弄这个搞了两天才出来的有时候不太稳定
https://www.cnblogs.com/pumpkinhlk/p/15410970.html
https://www.cnblogs.com/eve-d/p/15683541.html
第二个是在typecho里的直接修改外观改自定义CSS样式和自定义body标签末尾位置内容,自定义Footer内容可加可不加
CSS代码:
*{
transition: all 0.4s;
}
margin: 0 auto;
width: 80%;/原始65/
min-width: 980px;/页面顶部的宽度/
">rgba(245, 245, 245, 0.7);
padding: 30px;
margin-top: 50px;
margin-bottom: 50px;
box-shadow: 0 2px 6px rgba(100, 100, 100, 0.3);
}
body {
background-image: url("http://ww4.sinaimg.cn/large/637d0877gw1exlma5gj0wj21hc0u04p6.jpg");
background: rgba(12, 100, 129, 1) url('http://images.cnblogs.com/cnblogs_com/Penn000/1013849/o_123.jpg') fixed no-repeat;
background-position: 50% 5%;
background-size: cover;
}
cursor: pointer;
transition: all 0.2s;
}
transform: scale(1.5) rotate(360deg);
color:#FF0;
opacity:0.5;
}
height: 100px; /高度/
clear: both;
">rgba(245, 245, 245, 0);
}
font-size: 36px;
font-weight: bold;
line-height: 1.8em;/原始 1.6em/
margin-top: 10px;/原始 15px /
color: #548B54;
}
font-weight: normal;
font-size: 17px;/原始 16px ;font-size: 1.0rem;/
line-height: 1.8;
color: #111;
font-weight: bold;
text-align: right;
float: right;
}
">rgba(33, 160, 139, 0.9);
}
color: #eee;
font-size: 18px;
font-weight: bold;
}
.blogStats{
color: #eee;
}
.postTitle {
border-left: 8px solid rgba(33, 160, 139, 0.68);
margin-left: 10px;
margin-bottom: 10px;
font-size: 20px;
float: right;
width: 100%;
clear: both;
}
.postTitle a:link, .postTitle a:visited, .postTitle a:active {
color: #21759b;
transition: all 0.4s linear 0s;
}
.postTitle a:hover {
margin-left: 30px;
color: #0f3647;
text-decoration: none;
}
.postCon {
float: right;
line-height: 1.5em;
width: 100%;
clear: both;
padding: 10px 0;
}
.day .postTitle a {
padding-left: 10px;
}
.day {
background: rgba(255, 255, 255, 0.5);
}
/文章附加信息/
.postDesc {
background: url(images/posted_time.png) no-repeat 0 1px;
color: #757575;
float: left;
width: 100%;
clear: both;
text-align: left;
font-family: "微软雅黑" , "宋体" , "黑体" ,Arial;
font-size: 13px;
padding-right: 20px;/5px padding-left: 90px;posted 发表时间左边距离/
margin-top: 20px;
line-height: 1.8;
padding-bottom: 35px;
}
.newsItem, .catListEssay, .catListLink, .catListNoteBook, .catListTag, .catListPostCategory,
.catListPostArchive, .catListImageCategory, .catListArticleArchive, .catListView,
.catListFeedback, .mySearch, .catListComment, .catListBlogRank, .catList, .catListArticleCategory ,#blog-calendar
{
background: rgba(255, 255, 255, 0.5);
margin-bottom: 35px;
word-wrap: break-word;
}
.CalTitle{
background: rgba(255, 255, 255, 0);
}
.catListTitle{
">rgba(33, 160, 139, 0.9);
}
background: rgba(255, 255, 255, 0.5);
}
.c_ad_block{
display: none;
}
width: 100%;
height: 200px;
background: rgba(255, 255, 255, 0.5);
}
.CalNextPrev{background: rgba(255, 255, 255, 0);}
但是我觉得太长了因为太长了看起来很麻烦
canvas#live2dcanvas {
border: 0 !important;
left: 0;
}
这个相对了说比较适合
最重要的还是自定义body标签末尾位置内容
看板娘的图形代码地址合集:https://www.lanol.cn/post/305.html
还可以自己弄一张图片上去还有聊天内容也可以修改可以看看上面的链接
以上都是借鉴大佬们的如有侵权请及时告诉我,我立即修改!
其他版本:https://paugram.com/coding/add-poster-girl-with-plugin.html