博主介绍:?全网粉丝10W+,前互联网大厂软件研发、集结硕博英豪成立工作室。专注于计算机相关专业毕业设计项目实战6年之久,选择我们就是选择放心、选择安心毕业?感兴趣的可以先收藏起来,点赞、关注不迷路?
毕业设计:2023-2024年计算机毕业设计1000套(建议收藏)
毕业设计:2023-2024年最新最全计算机专业毕业设计选题汇总
技术栈:
Python语言、Django框架、selenium爬虫、Echarts可视化、携程网数据、HTML
美食数据爬虫分析可视化系统
(1)数据可视化大屏
(2)数据可视化分析
(3)美食数据
(4)后台数据管理
(5)个人信息
(6)数据爬取
美食数据爬虫分析可视化系统是一个基于Python语言和Django框架开发的数据爬虫系统。该系统使用selenium库来实现网页数据的爬取,并将爬取的数据存储到数据库中。同时,系统还使用Echarts库来实现数据的可视化展示。
该系统主要针对携程网的美食数据进行爬取和分析。通过爬虫技术,系统可以自动获取携程网上的美食相关信息,包括店铺名称、评分、评论数、地址等。用户可以根据自己的需求,设置爬取的城市、关键词等参数,来获取特定的美食数据。
系统将爬取到的数据存储到数据库中,用户可以通过系统提供的界面进行数据的查询和分析。系统支持按照城市、关键词等条件进行数据的筛选和排序,帮助用户找到符合自己需求的美食店铺。同时,系统还提供了数据的可视化展示功能,用户可以通过图表和地图来直观地了解美食数据的分布和趋势。
系统的前端界面使用HTML和Echarts库实现,用户可以通过浏览器访问系统进行操作和查看数据。系统的后端使用Django框架搭建,通过Python语言实现数据的爬取、存储和分析功能。
总之,美食数据爬虫分析可视化系统是一个功能强大的数据爬取和分析工具,可以帮助用户快速获取和分析携程网上的美食数据,为用户提供更好的美食选择和决策支持。
from django.shortcuts import render,HttpResponse,reverse,redirect
from django.contrib.auth.decorators import login_required
from meishi import models
from django.db.models import Q
from django.shortcuts import get_object_or_404,HttpResponseRedirect
import json
import random
# Create your views here.
@login_required
def index(request):
if request.method == 'GET':
datas = models.XinXi.objects.all().order_by('-id')
return render(request,r"projects\table_s.html",locals())
if request.method == 'POST':
data = request.POST.get('projects_name', '')
if data == '':
datas = models.XinXi.objects.all().order_by('-id')
elif data == 'all':
datas = models.XinXi.objects.all()
else:
datas = models.XinXi.objects.filter(Q(name__icontains=data)|Q(areaName__icontains=data)|Q(cateName__icontains=data))
return render(request,'projects/table_s.html',context={'datas':datas})
@login_required
def liuyanban(request):
if request.method == 'GET':
return render(request,'projects/liuyanban.html',locals())
elif request.method == 'POST':
data = request.POST
content = data.get("content")
if not content:
error = {"content":"数据不能为空"}
models.MessageBoard.objects.create(
name=request.user,
content = content
)
return redirect('apps:index')
@login_required
def fenxi1(request):
if request.method == 'GET':
return render(request,'projects/fenxi1.html',locals())
from numpy import mean
@login_required
def daping(request):
if request.method == 'GET':
datas = models.XinXi.objects.all()
#总价前八美食
datas1 = [{'name': resu.name, 'value': resu.avgPrice} for resu in datas]
datas1.sort(key=lambda x: x['value'], reverse=True)
names1 = []
for da1 in datas1[:8]:
names1.append(da1['name'])
datas1_value = datas1[:8]
datas2 = []
names2 = []
areaName_data = [i.cateName for i in datas ]
areaNames = list(set(areaName_data))
li1 = []
for resu in areaNames:
das = models.XinXi.objects.filter(cateName=resu)
num = 0
count1 = 0
for re1 in das:
num += re1.avgScore
count1 += 1
li1.append([resu,round(num/count1,2)])
li1.sort(key=lambda xx:xx[1],reverse=True)
for re2 in li1[:5]:
names2.append(re2[0])
datas2.append(re2[1])
datas2_value = []
# 各价格区间数量
a1 = models.XinXi.objects.filter(Q(avgPrice__gte= 0)&Q(avgPrice__lt=50))
a2 = models.XinXi.objects.filter(Q(avgPrice__gte= 50)&Q(avgPrice__lt= 100))
a3 = models.XinXi.objects.filter(Q(avgPrice__gte= 100)&Q(avgPrice__lt= 200))
a4 = models.XinXi.objects.filter(Q(avgPrice__gte= 200)&Q(avgPrice__lt= 500))
a5 = models.XinXi.objects.filter(Q(avgPrice__gte= 500))
datas5 = [len(a1), len(a2), len(a3), len(a4), len(a5)]
names5 = ['0-50', '50-100', '100-200', '200-500', '>500']
datas4 = []
#各类型菜式数量
datas22 = []
names22 = []
areaName_data = [i.cateName for i in datas ]
areaNames = list(set(areaName_data))
li1 = []
for resu in areaNames:
li1.append([resu,areaName_data.count(resu)])
li1.sort(key=lambda xx:xx[1],reverse=True)
for resu1 in li1:
names22.append(resu1[0])
datas22.append(resu1[1])
#各类型数量
data_cateName = [i.cateName for i in datas]
cateNames = list(set(data_cateName))
cateName_dict = []
for resu in cateNames:
cateName_dict.append({"name":resu,"value":data_cateName.count(resu)})
datas7 = [[resu.avgPrice, resu.avgScore, resu.name] for resu in datas]
cidys = list(set([resu.city for resu in datas]))
datas6 = []
for cidy in cidys:
values = models.XinXi.objects.filter(city__icontains=cidy)
datas6.append({'name': cidy+'市', 'value': len(values)})
print(datas6)
return render(request,'index.html',locals())
@login_required
def tubiao1(request):
if request.method == 'GET':
datas = models.XinXi.objects.all()
list1 = []
for da1 in datas:
list1.append([da1.name,round(da1.kouweifenshu+da1.huanjingfenshu+da1.fuwufenshu,2)])
list1.sort(key=lambda xx:xx[1],reverse=True)
avgScore_name = []
avgScore_count = []
for resu in list1[:10]:
avgScore_name.append(resu[0])
avgScore_count.append(resu[1])
data_cateName = [i.cateName for i in datas]
cateNames = list(set(data_cateName))
cateName_dict = []
for resu in cateNames:
cateName_dict.append({"name":resu,"value":data_cateName.count(resu)})
data_avgPrice = [round(int(i.avgPrice)/10)*10 for i in datas]
avgPrices = list(set(data_avgPrice))
avgPrices.sort()
avgPrice_name = []
avgPrice_count = []
for resu in avgPrices:
avgPrice_name.append(resu)
avgPrice_count.append(data_avgPrice.count(resu))
return render(request,'projects/keshihua1.html',locals())
@login_required
def user_profile(request):
if request.method == 'GET':
return render(request,'projects/user-profile.html',locals())
@login_required
def update_user(request):
if request.method == 'GET':
data = models.Users.objects.get(username=request.user.username)
return render(request,'projects/form_validations.html',locals())
elif request.method == 'POST':
datas = models.Users.objects.get(username=request.user.username)
error = {}
data = request.POST
email = data.get('email','')
if email != '' and '@' in str(email):
email = email
else:
error['email'] = '邮箱格式错误'
age = data.get('age','')
try:
int(age)
if age != '' and 0 < int(age) and int(age) < 120:
age = age
else:
raise Exception('年龄错误')
except:
error['age'] = '年龄错误'
set = data.get('set','')
if set != '' and str(set) in ['男','女']:
set = set
else:
error['set'] = '性别格式错误'
if error != {}:
return render(request,'projects/form_validations.html',context={'data':datas,'error':error})
else:
models.Users.objects.filter(username=request.user.username).update(email=email,age=age,set=set)
user = request.user
return render(request, 'projects/user-profile.html', locals())
@login_required
def fenxi(request):
if request.method == 'GET':
datas = models.XinXi.objects.all()
return render(request,'projects/fenxi.html',locals())
🍅?感兴趣的可以先收藏起来,点赞关注不迷路,想学习更多项目可以查看主页,大家在毕设选题,项目代码以及论文编写等相关问题都可以给我留言咨询,希望可以帮助同学们顺利毕业!🍅?
🍅由于篇幅限制,获取完整文章或源码、代做项目的,拉到文章底部即可看到个人联系方式。🍅
点赞、收藏、关注,不迷路,下方查看👇🏻获取联系方式👇🏻