租房数据分析可视化大屏+58同城 Django框架 大数据毕业设计(附源码)?
毕业设计:2023-2024年计算机专业毕业设计选题汇总(建议收藏)
毕业设计:2023-2024年最新最全计算机专业毕设选题推荐汇总
🍅感兴趣的可以先收藏起来,点赞、关注不迷路,大家在毕设选题,项目以及论文编写等相关问题都可以给我留言咨询,希望帮助同学们顺利毕业?。🍅
1、项目介绍
技术栈:
python租房数据分析可视化系统 毕业设计 58同城
python语言、MySQL数据库、Django框架、Echarts可视化
租房数据分析可视化系统是一个基于python语言、MySQL数据库、Django框架和Echarts可视化技术开发的系统。该系统旨在帮助用户通过对租房数据进行分析和可视化展示,提供更直观、全面的租房市场信息,以便用户做出更明智的租房决策。
2、项目界面
(1)租房数据可视化大屏
(2)租房数据管理
(3)系统首页
(4)租房数据条件查询
(5)评论功能
(6)租房数据
3、项目说明
租房数据分析可视化系统是一个基于python语言、MySQL数据库、Django框架和Echarts可视化技术开发的系统。该系统旨在帮助用户通过对租房数据进行分析和可视化展示,提供更直观、全面的租房市场信息,以便用户做出更明智的租房决策。
系统主要包括以下功能:
-
数据采集与存储:系统通过爬虫技术从58同城等租房网站上采集租房相关数据,并将其存储到MySQL数据库中,包括房源信息、租金、房屋面积、地理位置等各项数据。
-
数据清洗与处理:对采集到的数据进行清洗和处理,包括去除重复数据、处理缺失值、格式化数据等,以确保数据的准确性和一致性。
-
数据分析与统计:通过对租房数据进行统计和分析,提取出各种有价值的信息,包括不同城市的租金分布、租房面积分布、租房热门区域等,为用户提供全面的租房市场概况。
-
可视化展示:利用Echarts可视化技术,将分析结果以图表的形式展示给用户,包括柱状图、饼图、地图等,使用户更直观地了解租房市场的情况。
-
用户管理与权限控制:系统提供用户管理功能,包括用户注册、登录、密码找回等,同时还可以根据用户的身份和权限,控制其对系统功能的访问和使用。
通过租房数据分析可视化系统,用户可以快速了解租房市场的情况,包括租金水平、热门区域、房屋面积分布等,从而更好地选择合适的租房房源。同时,系统还可以为租房从业人员、房产中介等提供市场调研和决策支持。
4、核心代码
# -*- coding: utf-8 -*-
import random
import time
from urllib import parse
from datetime import date, datetime
from django.shortcuts import redirect
from ..common.helper import *
from ..common.vercode import *
from simple_mysql import db as mysql
import base64
# 处理时间对象序列化问题
class DateEncoder(json.JSONEncoder):
def default(self, obj):
if isinstance(obj, datetime):
return obj.strftime("%Y-%m-%d %H:%I:%S")
elif isinstance(obj, date):
return obj.strftime("%Y-%m-%d")
else:
return json.JSONEncoder.default(self, obj)
def index(request):
'''
重定向到前端主页
:param request:
:return:
'''
return redirect('/dist/index.html')
#从前端获取传递的参数后,在数据库中查询相关信息并给出结果。
#和数据库进行交互
# 登录
def login(request):
name = request.POST.get("username")
password = request.POST.get("pwd")
role = request.POST.get("role", 1)
if request.session.get('verify') != request.POST.get("code"):
return jsonResponse(1, '验证码错误')
db = mysql().connection(DATABASE)
user = db.table('user').where({"name": name, "pass": password, "role": role}).find()
print(user)
if user is None:
return jsonResponse(1, '账号或者密码错误')
else:
timestamp = time.time()
token = md5(str(user["id"]) + user["pass"] + str(timestamp))
db.table('user').where({"id": user["id"]}).save({"token": token})
data = {
"token": token,
"user": user
}
return jsonResponse(0, '登录成功', data)
# 注册
def register(request):
name = request.POST.get("username")
password = request.POST.get("pwd")
if len(password) > 10 or len(password) < 6:
return jsonResponse(1, '密码位数应大于6小于10')
db = mysql().connection(DATABASE)
result = db.table('user').where({"name": name}).find()
if result:
return jsonResponse(1, '用户名已经注册')
user = db.table('user').add({
"name": name,
"pass": password,
"role": 1
})
if user:
return jsonResponse(0, '注册成功')
return jsonResponse(1, '注册失败')
# 上传文件
def upload(request):
content = request.FILES.get("file", None)
file_dir = os.path.join(UPLOAD_DIR, time.strftime('%Y%m%d'))
if not os.path.exists(file_dir):
os.makedirs(file_dir)
file = os.path.join(file_dir, content.name)
storage = open(file, 'wb+')
for chunk in content.chunks():
storage.write(chunk)
storage.close()
dir = '/static/uploads/{}/{}'.format(time.strftime('%Y%m%d'), content.name)
return jsonResponse(0, '上传成功', dir)
# 使用pillow生成验证码
def verify(request):
code = imageCode()
code.getVerifyCode()
image, text = code.getVerifyCode()
# 图片以二进制形式写入
buf = BytesIO()
image.save(buf, 'jpeg')
buf_str = buf.getvalue()
request.session['verify'] = text
return jsonResponse(0, '验证码生成成功', {"code": str(base64.b64encode(buf_str), 'utf-8'), "value": text})
def house(request):
if request.method == "GET":
page = request.GET.get("page", 1)
limit = request.GET.get("limit", 10)
keyword = request.GET.get("keyword")
area = request.GET.get("area")
price = request.GET.get("price")
room = request.GET.get("room")
type = request.GET.get("type")
id = request.GET.get("id")
condition = {}
db = mysql().connection(DATABASE)
if keyword:
# 解码url中文参数keyword
condition["city"] = ["LIKE", "%{}%".format(parse.unquote_plus(keyword)), "", "e"]
if area:
if "以上" in area:
condition["room_area"] = ["GT", area.replace("以上", ""), "", "e"]
else:
min_area = area.split("-")[0]
max_area = area.split("-")[1].replace("㎡", "").replace("以上", "")
condition["room_area"] = ["BETWEEN", [min_area, max_area], '', 'e']
if price:
if "以上" in price:
condition["price"] = ["GT", price.replace("万", "").replace("以上", ""), "", "e"]
else:
min_price = price.split("-")[0]
max_price = price.split("-")[1].replace("/月", "")
condition["price"] = ["BETWEEN", [min_price, max_price], '', 'e']
if room:
condition["room"] = ["LIKE", "%{}%".format(room.replace("以上", "")), "", "e"]
if type:
condition["type"] = type
if len(condition) > 0:
count = db.table('house').where(condition).count()
data = db.table('house').where(condition).page(page, limit).order("id desc").select()
elif id:
data = db.table('house').where({"id": id}).find()
return jsonResponse(0, 'success', data)
else:
count = db.table('house').count()
data = db.table('house').page(page, limit).order('id desc').select()
return jsonResponse(0, 'success', data, count)
elif request.method == "POST":
pass
elif request.method == "PUT":
pass
elif request.method == "DELETE":
# 删除数据
db = mysql().connection(DATABASE)
id = request.GET.get("id")
result = db.table('house').where({"id": id}).delete()
if result:
return jsonResponse(0, '删除成功')
return jsonResponse(1, '删除失败')
def news(request):
db = mysql().connection(DATABASE)
if request.method == "GET":
page = request.GET.get("page", 1)
limit = request.GET.get("limit", 10)
keyword = request.GET.get("keyword")
id = request.GET.get("id")
category = request.GET.get("category")
condition = {}
db = mysql().connection(DATABASE)
if id:
uid = request.GET.get("uid")
data = db.table("news").where({"id": id}).find()
# 记录浏览量
db.table("news").where({"id": id}).save({"view": data["view"] + 1})
# db.table("news").where({"id": id}).setInc("view")
word_list = get_words(data["title"])
count = ",".join([i[0] for i in word_list])
elif keyword:
# 解码url中文参数keyword
q = parse.unquote_plus(keyword)
condition["title"] = ["LIKE", "%{}%".format(q), "", "e"]
count = db.table('news').where(condition).count()
data = db.table('news').where(condition).page(page, limit).order("view desc,reply desc").select()
else:
if category:
condition["category"] = category
count = db.table('news').where(condition).count()
data = db.table('news').where(condition).page(page, limit).order('id desc').select()
else:
count = db.table('news').count()
data = db.table('news').page(page, limit).order('id desc').order("view desc,reply desc").select()
return jsonResponse(0, 'success', data, count)
elif request.method == "POST":
data = json.loads(request.body.decode('utf-8'))
res = db.table('news').add(data)
if res:
result = {"code": 0, "msg": "添加成功"}
else:
result = {"code": 1, "msg": "添加失败"}
return JsonResponse(result)
elif request.method == 'PUT':
data = json.loads(request.body.decode('utf-8'))
id = data.get("id")
res = db.table('news').where({"id": id}).save(data)
if res:
result = {"code": 0, "msg": "操作成功"}
else:
result = {"code": 1, "msg": "操作失败"}
return JsonResponse(result)
elif request.method == "DELETE":
# 删除数据
id = request.GET.get("id")
result = db.table('news').where({"id": id}).delete()
if result:
return jsonResponse(0, '删除成功')
return jsonResponse(1, '删除失败')
def data(request):
'''
分析数据
'''
db = mysql().connection(DATABASE)
room = db.table("house").group("room").field("room as name,avg(price) as value").order("value desc").limit(
10).group("room").select()
address = db.table("house").field("name,price").select()
address_list = [i["name"] for i in address]
text = " ".join(address_list)
keyword = get_words(text)
room_area_line = db.table("house").field("room_area as name,count(*) as value").group("room_area").select()
area = db.table("house").field("room as name,price as value").order("name asc").select()
statis = db.table("house").field("name,statis as value").order("value desc").limit(10).select()
room_type = db.table("house").field("room_type as name,count(*) as value").order("value desc").group(
"room_type").limit(10).select()
bj_area_price = db.table("house").where("city = '北京'").field("area as name,price as value").order(
"value desc").select()
bj_area_price = [[i["name"].split(",")[0], i["value"]] for i in bj_area_price]
hot_city = db.table("house").group("city").field("city as name,count(*) as value").order("value desc").select()
data = {
"room": room,
"keyword": keyword,
"area": area,
"statis": statis,
"room_type": room_type,
"bj_area_price": bj_area_price,
"hot_city": hot_city,
"room_area_line": room_area_line
}
return jsonResponse(0, '成功', data)
def user(request):
db = mysql().connection(DATABASE)
if request.method == "GET":
page = request.GET.get("page")
limit = request.GET.get("limit")
key = request.GET.get("key")
id = request.GET.get("id")
keyword = request.GET.get("keyword")
condition = {}
if keyword:
condition["name"] = ["LIKE", "%{}%".format(keyword), "", "e"]
count = db.table('user').where(condition).count()
data = db.table('user').where(condition).page(page, limit).order('id desc').select()
elif id:
count = db.table('user').where({"id": id}).count()
data = db.table('user').where({"id": id}).order('id desc').find()
else:
count = db.table('user').count()
data = db.table('user').page(page, limit).order('id desc').select()
return jsonResponse(0, 'success', data, count)
elif request.method == "PUT":
data = json.loads(request.body)
id = data.get("id")
result = db.table('user').where({"id": id}).save(data)
if result:
return jsonResponse(0, '修改成功')
return jsonResponse(1, '修改失败')
elif request.method == "POST":
data = json.loads(request.body)
result = db.table('user').add(data)
if result:
return jsonResponse(0, '添加成功')
return jsonResponse(1, '添加失败')
elif request.method == "DELETE":
id = request.GET.get("id")
result = db.table('user').where({"id": id}).delete()
if result:
return jsonResponse(0, '删除成功')
return jsonResponse(1, '删除失败')
5、源码获取方式
🍅由于篇幅限制,获取完整文章或源码、代做项目的,查看我的【用户名】、【专栏名称】、【顶部选题链接】就可以找到我啦🍅
感兴趣的可以先收藏起来,点赞、关注不迷路,下方查看👇🏻获取联系方式👇🏻
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。 如若内容造成侵权/违法违规/事实不符,请联系我的编程经验分享网邮箱:veading@qq.com进行投诉反馈,一经查实,立即删除!