0 前言
?? 這兩年開始畢業(yè)設(shè)計和畢業(yè)答辯的要求和難度不斷提升,傳統(tǒng)的畢設(shè)題目缺少創(chuàng)新和亮點,往往達不到畢業(yè)答辯的要求,這兩年不斷有學(xué)弟學(xué)妹告訴學(xué)長自己做的項目系統(tǒng)達不到老師的要求。
為了大家能夠順利以及最少的精力通過畢設(shè),學(xué)長分享優(yōu)質(zhì)畢業(yè)設(shè)計項目,今天要分享的是
?? 基于大數(shù)據(jù)的工作崗位數(shù)據(jù)分析與可視化
??學(xué)長這里給一個題目綜合評分(每項滿分5分)
- 難度系數(shù):3分
- 工作量:3分
- 創(chuàng)新點:3分
1 課題背景
基于python+flask的python崗大數(shù)據(jù)可視化web系統(tǒng),可以進行數(shù)據(jù)交互可視化,主題為python崗位相關(guān)大數(shù)據(jù)分析。
2 實現(xiàn)效果
??Web_App動作描述
用戶點擊導(dǎo)航欄四個選項,跳轉(zhuǎn)到想了解的頁面
- 平均月薪
- 崗位數(shù)量
- 工作經(jīng)驗
- 最低學(xué)歷
用戶通過選擇器點擊想要了解的城市,可顯示該城市的相關(guān)崗位數(shù)量
鼠標下拉可看文字結(jié)論分析
3 項目實現(xiàn)
3.1 概括
- 主運行文件為 app.py 文件。
- static 文件為網(wǎng)頁樣式。
- templates 里的map.html系列文件為生成可視化圖表的離線文件,作為引用文件。
- data1.csv 等csv文件為引用的數(shù)據(jù)文檔。csv檔 為數(shù)據(jù)源。
- 在flask環(huán)境下導(dǎo)入
pandas
、pyecharts
實現(xiàn)數(shù)據(jù)圖表交互展示。 - 寫出四個@route,分別呈現(xiàn)為各省python相關(guān)崗位平均月薪、各省python相關(guān)崗位數(shù)量、工作經(jīng)驗與最低要求學(xué)歷的職位分布數(shù)量、最低學(xué)歷-工作經(jīng)驗與平 均月薪的相關(guān)圖表展示。
-
df = pd.read_csv('xxx.csv',encoding = 'utf8', index_col="xxx")
英文采用單字節(jié)編碼,部分中文采用雙字節(jié)編碼。 - 利用
.renter/with open
導(dǎo)入和打開文件。 - 調(diào)用
pyecharts
模塊作圖傳輸?shù)紿TML頁面。 - 使用
list
字典循環(huán)。 - 使用列表推導(dǎo)式進行取值。
3.2 Flask實現(xiàn)
數(shù)據(jù)循環(huán)
數(shù)據(jù)嵌套
推導(dǎo)式
條件判斷
數(shù)據(jù)交互
3.3 HTML頁面交互及Jinja2
Jinja2介紹
jinja2是Flask作者開發(fā)的一個模板系統(tǒng),起初是仿django模板的一個模板引擎,為Flask提供模板支持,由于其靈活,快速和安全等優(yōu)點被廣泛使用。
jinja2的優(yōu)點
jinja2之所以被廣泛使用是因為它具有以下優(yōu)點:
- 相對于Template,jinja2更加靈活,它提供了控制結(jié)構(gòu),表達式和繼承等。
- 相對于Mako,jinja2僅有控制結(jié)構(gòu),不允許在模板中編寫太多的業(yè)務(wù)邏輯。
- 相對于Django模板,jinja2性能更好。
- Jinja2模板的可讀性很棒。
項目代碼文章來源:http://www.zghlxwxcb.cn/news/detail-728410.html
文章來源地址http://www.zghlxwxcb.cn/news/detail-728410.html
4 完整代碼
import random
from calendar import c
from tkinter import Grid
from flask import Flask,render_template,request
import pandas as pd
from pyecharts import options as opts
from pyecharts.charts import Map, EffectScatter, HeatMap, Line,Grid
from pyecharts.faker import Faker
from pyecharts.globals import SymbolType
from pyecharts.charts import Pie,Bar
df = pd.read_csv('data1.csv')
app = Flask(__name__)
@app.route('/')
def map() -> 'html':
a = (
Map()
.add("平均月薪", list(zip(df.省, df.平均月薪)), "china")
.set_global_opts(
title_opts=opts.TitleOpts(title="各省python相關(guān)崗位平均月薪"),
visualmap_opts=opts.VisualMapOpts(min_=7164.08, max_=17096.07),
)
)
a.render("./templates/map.html")
with open("./templates/map.html", encoding="utf8", mode="r") as f:
map = "".join(f.readlines())
the_select_province = {'北京':'4924',
'上海':'3114',
'廣東':'3164',
'浙江':'1244',
'南京':'701',
'湖北':'412',
'江蘇':'450',
'福建':'359',
'四川':'985',
'遼寧':'227',
'安徽':'236',
'湖南':'239',
'山東':'360',
'吉林':'88',
'江西':'60',
'天津':'355',
'山西':'417',
'陜西':'60',
'重慶':'179',
'黑龍江':'60',
'河南':'477',
'貴州':'60',
'河北':'60',}
return render_template('python_map.html',
the_map=map,
the_province=the_select_province
)
element = list(set(most['分類']))
@app.route('/effectscatter_symbol')
def effectscattere_symbol() -> 'html':
df = pd.read_csv('data2.csv',encoding = 'utf8', index_col="名稱")
省 = list(df.loc["省"].values)[-24:]
數(shù)量 = list(df.loc["數(shù)量"].values)[-24:]
value = [[i, j, random.randint(0, 80)] for i in range(24) for j in range(24)]
c = (
HeatMap()
.add_xaxis(省)
.add_yaxis("數(shù)量", 數(shù)量, value)
.set_global_opts(
title_opts=opts.TitleOpts(title="各省Python相關(guān)崗位數(shù)量"),
visualmap_opts=opts.VisualMapOpts(),
)
)
c.render("./templates/effectscatter_symbol.html")
with open("./templates/effectscatter_symbol.html", encoding="utf8", mode="r") as f:
sym = "".join(f.readlines())
return render_template('python_effectscatter_symbol.html',
the_sym=sym,
)
1
data_pie1 = data_pie.T.to_html()
pie1_list = [num for num in data_pie['分類']]
labels = [index for index in data_pie.index]
@app.route('/pie_base')
def pie_base() -> 'html':
df = pd.read_csv('data3.csv', encoding='utf8')
bar = (
Bar()
.add_xaxis(['不限', '3-5年', '1-3年', '5-10年', '無經(jīng)驗', '一年以下', '10年以上'])
.add_yaxis("職位數(shù)量", [6183, 5164, 4842, 1516, 366, 111, 34])
.set_global_opts(title_opts=opts.TitleOpts(title="工作經(jīng)驗-職位分布數(shù)量"))
)
line = (
Line()
.add_xaxis(['本科', '大專', '不限', '碩士', '博士', '中專'])
.add_yaxis("職位數(shù)量", [9954, 3704, 3205, 1137, 88, 31])
.set_global_opts(
title_opts=opts.TitleOpts(title="最低要求學(xué)歷-職位分布數(shù)量", pos_top="50%"),
legend_opts=opts.LegendOpts(pos_top="50%"),
)
)
grid = (
Grid()
.add(bar, grid_opts=opts.GridOpts(pos_bottom="60%", pos_right="0", height="30%"))
.add(line, grid_opts=opts.GridOpts(pos_top="60%", pos_right="0", height="30%"))
)
bar,line,grid.render("./templates/pie_base.html")
with open("./templates/pie_base.html", encoding="utf8", mode="r") as f:
pie_base = "".join(f.readlines())
return render_template('python_pie_base.html',
the_pie_base=pie_base,
)
the_element3 = request.form['the_element3_selected']
print(the_element3)
element3_available = element3
if the_element3 =='廣州':
the_level = 廣州
elif the_element3 =='上海':
the_level = 上海
elif the_element3 =='北京':
the_level = 北京
else:
the_level = 其它
def python_most():
title1 = "最低學(xué)歷"
data_pie = pd.DataFrame(pressure2.loc['最低學(xué)歷與工作經(jīng)驗的關(guān)系']['分類'].value_counts())
data_pie1 = data_pie.T.to_html()
pie1_list = [num for num in data_pie['分類']]
labels = [index for index in data_pie.index]
@app.route('/Bar/')
def bar_base() -> Bar:
df = pd.read_csv('data4.csv', encoding='utf8', index_col="學(xué)歷")
最低學(xué)歷 = list(df.loc["最低學(xué)歷"].values)[-6:]
無經(jīng)驗 = list(df.loc["無經(jīng)驗"].values)[-6:]
一年以下 = list(df.loc["一年以下"].values)[-6:]
不限 = list(df.loc["不限"].values)[-24:]
一至三年 = list(df.loc["一至三年"].values)[-24:]
三至五年 = list(df.loc["三至五年"].values)[-24:]
五至十年 = list(df.loc["五至十年"].values)[-24:]
十年以上 = list(df.loc["十年以上"].values)[-24:]
c = (
Line()
.add_xaxis(最低學(xué)歷)
.add_yaxis("無經(jīng)驗", 無經(jīng)驗)
.add_yaxis("一年以下", 一年以下)
.add_yaxis("不限", 不限)
.add_yaxis("一至三年", 一至三年)
.add_yaxis("三至五年", 三至五年)
.add_yaxis("五至十年", 五至十年)
.add_yaxis("十年以上", 十年以上)
.set_global_opts(title_opts=opts.TitleOpts(title="最低學(xué)歷-工作經(jīng)驗與平均月薪",
subtitle="平均月薪(元)"))
)
c.render("./templates/Bar.html")
with open("./templates/Bar.html", encoding="utf8", mode="r") as f:
bar_base= "".join(f.readlines())
return render_template('python_bar.html',
the_bar_base=bar_base,
)
return render_template('first.html',
the_title1 = title1,
the_select_element1 = element1_available,
the_data_pie1 = data_pie1,
the_pyecharts_all = plot_all,
the_pyecharts_all1 = plot_all1,
the_pyecharts_all3 = plot_all3,
5 最后
到了這里,關(guān)于計算機畢設(shè) 大數(shù)據(jù)工作崗位數(shù)據(jù)分析與可視化 - python flask的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!