0 前言
?? 這兩年開始畢業(yè)設(shè)計(jì)和畢業(yè)答辯的要求和難度不斷提升,傳統(tǒng)的畢設(shè)題目缺少創(chuàng)新和亮點(diǎn),往往達(dá)不到畢業(yè)答辯的要求,這兩年不斷有學(xué)弟學(xué)妹告訴學(xué)長(zhǎng)自己做的項(xiàng)目系統(tǒng)達(dá)不到老師的要求。
為了大家能夠順利以及最少的精力通過(guò)畢設(shè),學(xué)長(zhǎng)分享優(yōu)質(zhì)畢業(yè)設(shè)計(jì)項(xiàng)目,今天要分享的是
?? **基于python的旅游數(shù)據(jù)分析可視化系統(tǒng) **
??學(xué)長(zhǎng)這里給一個(gè)題目綜合評(píng)分(每項(xiàng)滿分5分)
- 難度系數(shù):3分
- 工作量:4分
- 創(chuàng)新點(diǎn):4分
?? 選題指導(dǎo), 項(xiàng)目分享:
https://gitee.com/dancheng-senior/project-sharing-1/blob/master/%E6%AF%95%E8%AE%BE%E6%8C%87%E5%AF%BC/README.md
1 課題背景
精神文明日益發(fā)展的今天, 出行旅游成為人們的主要休閑方式和社會(huì)經(jīng)濟(jì)活動(dòng), 旅游業(yè)不僅能推動(dòng)多個(gè)產(chǎn)業(yè)的發(fā)展, 調(diào)節(jié)產(chǎn)業(yè)結(jié)構(gòu), 同時(shí)也滿足了人們?nèi)找嬖鲩L(zhǎng)的文化需要。其越來(lái)越成為國(guó)民經(jīng)濟(jì)的重要支撐。相關(guān)數(shù)據(jù)顯示, 疫情平穩(wěn)期間的旅游人數(shù)仍然穩(wěn)中有增。而與之相對(duì)應(yīng)的是海量的無(wú)序化旅游數(shù)據(jù)日益激增。針對(duì)有效旅游數(shù)據(jù)進(jìn)行準(zhǔn)確分析、 合理預(yù)測(cè)有助于制定與旅游發(fā)展相關(guān)的規(guī)劃, 同時(shí)能有效地幫助后續(xù)在旅游設(shè)施分配和資源調(diào)度等方面上制定明智的決策, 發(fā)揮旅游信息價(jià)值的最大化。由此可知, 旅游經(jīng)濟(jì)的發(fā)展與對(duì)數(shù)據(jù)的合理分析是密不可分的。
2 數(shù)據(jù)處理
采用Python爬蟲技術(shù)對(duì)某大同市旅游景點(diǎn)數(shù)據(jù)進(jìn)行采集,用Python中的Pandas庫(kù)對(duì)采集到的數(shù)據(jù)進(jìn)行整理, 首先將旅游數(shù)據(jù)轉(zhuǎn)化成DataFrame格式, 再?gòu)亩鄠€(gè)維度和角度進(jìn)行處理分析。使用isnull函數(shù)選取查看缺失值占總數(shù)據(jù)百分比大于90%的列名及其數(shù)值, 認(rèn)為它在數(shù)據(jù)分析中提供極其有限信息, 所以直接刪除。對(duì)缺失數(shù)據(jù)采用fillna函數(shù)根據(jù)數(shù)據(jù)的不同類型進(jìn)行了固定值填充, 異常值(也稱為離群值)檢測(cè)是一個(gè)重要的部分, 用duplicated函數(shù)表示重復(fù)行的布爾系列值, 返回缺失總數(shù)后進(jìn)行去重。
采用選擇(loc)、 分組(groupby)、 連接(merge)、 匯總統(tǒng)計(jì)(mean)等方法進(jìn)行數(shù)據(jù)的統(tǒng)計(jì)與處理。處理完后利用其自帶接口將數(shù)據(jù)存入到mysql數(shù)據(jù)庫(kù)中。
3 Django使用echarts進(jìn)行可視化展示(mysql數(shù)據(jù)庫(kù))
3.1 修改setting.py連接mysql數(shù)據(jù)庫(kù)
# settings.py 文件
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
# mysql 數(shù)據(jù)庫(kù)名
'NAME': 'my_db',
# mysql 登陸用戶名
'USER': 'root',
# myslq 登陸密碼
'PASSWORD': '123456',
'HOST': 'localhost',
'PORT': '3306',
}
}
3.2 導(dǎo)入數(shù)據(jù)
可以直接在 mysql 數(shù)據(jù)庫(kù)中添加數(shù)據(jù),也可以使用超級(jí)用戶在 admin 管理頁(yè)面中添加數(shù)據(jù)
from django.db import models
# Create your models here.
# 然后輸入
# python manage.py makemigrations #數(shù)據(jù)庫(kù)變動(dòng)的記錄(并不會(huì)幫你創(chuàng)建表)
# python manage.py migrate #將你的數(shù)據(jù)庫(kù)變動(dòng)同步到數(shù)據(jù)庫(kù)中(這下才是真正創(chuàng)建表了)
class Cityall(models.Model):
id = models.AutoField(primary_key=True)
cityname = models.CharField(max_length=100, blank=True)
renqi = models.CharField(max_length=100, blank=True)
hot = models.CharField(max_length=100, blank=True)
class Meta:
db_table = 'cityall'
數(shù)據(jù)庫(kù)內(nèi)容:
3.3 使用echarts可視化展示
- 設(shè)置靜態(tài)文件目錄(即 static 目錄)
# settings.py 文件
STATICFILES_DIRS=(os.path.join(BASE_DIR,'static'),)
- 創(chuàng)建如下目錄結(jié)構(gòu):
- js 目錄中為 echarts的 js 文件,大家可以在 echarts官網(wǎng)下載自己需要的版本,index.html 文件內(nèi)容如下
#部分代碼,不完整
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>大同市旅游景點(diǎn)可視化系統(tǒng)</title>
<script src="/static/jquery/jquery-1.8.3.min.js"></script>
<script src="https://libs.baidu.com/jquery/1.10.2/jquery.min.js"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/echarts/4.2.1/echarts.min.js"></script>
</head>
<body>
<div class="container-header">
<ul class="nowTime">
<li></li>
<li></li>
</ul>
<div class="location">
<i class="icon iconfont icon-buoumaotubiao23"></i>
<span class="areaName"></span>
</div>
<h3 style="font-size:28px;"> 大同市旅游景點(diǎn)可視化系統(tǒng)
</h3>
</div>
<div class="container-content">
<div class="top">
<div class="count-base">
<div class="com-count-title">A級(jí)景區(qū)比例</div>
<div class="com-screen-content">
<div id="main1" style="width:100%;height:300px;"></div>
</div>
<span class="left-top"></span>
<span class="right-top"></span>
<span class="left-bottom"></span>
<span class="right-bottom"></span>
</div>
<div class="count-resource q1">
<div class="com-count-title">旅游資源統(tǒng)計(jì)</div>
<div class="com-screen-content2">
<ul class="use-data">
<li>
<p class="data-count" id="jinqunum">0 </p>
<span class="data-name">A級(jí)景區(qū)</span>
</li>
<li>
<p class="data-count" id="jiudiannum"> 0</p>
<span class="data-name">星級(jí)酒店</span>
</li>
<li>
<p class="data-count" id="lvxingshe">0</p>
<span class="data-name">旅行社</span>
</li>
</ul>
<div class="com-screen-content">
<div id="main2" style="margin-top:10px;width:100%;height:240px;"></div>
</div>
<span class="left-top"></span>
<span class="right-top"></span>
<span class="left-bottom"></span>
<span class="right-bottom"></span>
</div>
</div>
<div class="count-resource q2">
<div class="com-count-title">游記數(shù)據(jù)</div>
<div class="com-screen-content">
<ul class="data-label">
<li class="active" data-type="1">游記</li>
</ul>
<ul class="use-data">
</ul>
<div id="main3" style="margin-top:10px;width:100%;height:240px;">
</div>
</div>
<span class="left-top"></span>
<span class="right-top"></span>
<span class="left-bottom"></span>
<span class="right-bottom"></span>
</div>
</div>
......
-
編寫 views.py 文件,將數(shù)據(jù)庫(kù)中的數(shù)據(jù)傳到前端頁(yè)面中
import json from multiprocessing import connection from sqlite3.dbapi2 import IntegrityError from django.core import serializers from django.core.serializers.json import DjangoJSONEncoder from django.forms import model_to_dict from django.http import HttpResponse, JsonResponse from django.shortcuts import render def index(request): # print(request.method) #獲取請(qǐng)求方式GET或POST return render(request, 'index.html') # 回復(fù)一個(gè)頁(yè)面
4 實(shí)現(xiàn)效果
使用的數(shù)據(jù)是處理好后導(dǎo)入到mysql數(shù)據(jù)庫(kù)中的數(shù)據(jù),現(xiàn)在,我們來(lái)看一下展示效果,運(yùn)行
python manage.py runserver
4.1前端展示
4.2 熱門旅游城市展示
4.3 旅游景點(diǎn)推薦
系統(tǒng)基于當(dāng)前景點(diǎn)的人流密度、交通流量和景點(diǎn)熱度等特征進(jìn)行城市景點(diǎn)路線的智能規(guī)劃:
文章來(lái)源:http://www.zghlxwxcb.cn/news/detail-426067.html
4.4 后端監(jiān)控系統(tǒng)
文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-426067.html
5 最后
到了這里,關(guān)于畢業(yè)設(shè)計(jì) 基于大數(shù)據(jù)的旅游數(shù)據(jù)分析與可視化系統(tǒng)的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!