国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

【數(shù)據(jù)可視化】大作業(yè)(意向考研高校的數(shù)據(jù)可視化)

這篇具有很好參考價值的文章主要介紹了【數(shù)據(jù)可視化】大作業(yè)(意向考研高校的數(shù)據(jù)可視化)。希望對大家有所幫助。如果存在錯誤或未考慮完全的地方,請大家不吝賜教,您也可以點擊"舉報違法"按鈕提交疑問。


前言

  • 將該高校的地理位置以地圖的形式展示。
  • 將該高校近幾年計算機相關(guān)專業(yè)的考研(或高考)錄取成績、人數(shù)信息,專業(yè)師資隊伍,考試科目及內(nèi)容等等以合適的柱狀圖、折線圖、餅圖等方式表示出來,圖表能夠清晰得呈現(xiàn)不同數(shù)據(jù)的變化,使得觀察圖表的人能夠迅速得獲取信息。
    • 錄取成績、錄取人數(shù)信息、專業(yè)師資隊伍
    • 柱狀圖、折線圖、餅圖
  • 對個人感興趣的導(dǎo)師、研究方向等多屬性、多維度、多關(guān)系數(shù)據(jù)選用關(guān)系、詞云等可視化方法,使數(shù)據(jù)清晰有效地表達。
    • 研究方向(關(guān)系+詞云)
  • 其它自由發(fā)揮部分

一、數(shù)據(jù)介紹

1.1 基本信息

  • 學(xué)校名稱:山東理工大學(xué)
  • 地理位置:山東省淄博市,北緯36.810315,東經(jīng)117.999601
  • 院校:計算機科學(xué)與技術(shù)學(xué)院

1.2 考研信息

  • 下載相關(guān)信息:2020考研擬錄取名單:山東理工大學(xué)2020年碩士研究生擬錄取名單
  • PDF識別為Excel:PDF在線轉(zhuǎn)換工具、WPS會員(鈔能力)、python

通過網(wǎng)絡(luò)搜集2020-2022年,山東理工大學(xué)計算機科學(xué)與技術(shù)專業(yè)(學(xué)碩+專碩)第一志愿錄取情況信息,具體信息包括:復(fù)試學(xué)院代碼,復(fù)試學(xué)院,姓名,初試考試編號,復(fù)試專業(yè)代碼,復(fù)試專業(yè)名稱,研究方向代碼,學(xué)習(xí)形式,一志愿/調(diào)劑,初試成績,綜合面試成績",總成績,排名,錄取結(jié)果,備注。需要注意的是該數(shù)據(jù)并非來自官網(wǎng)(學(xué)校官網(wǎng)信息已關(guān)閉),在數(shù)據(jù)結(jié)果上存在誤差。

import PyPDF2
import pytesseract
import pandas as pd
import os

# 設(shè)置OCR引擎(如果需要)
# pytesseract.pytesseract.tesseract_cmd = r'/usr/bin/tesseract'  # 指定Tesseract OCR引擎的路徑

# 將PDF文件轉(zhuǎn)換為文本
def pdf_to_text(pdf_path):
    text = ""
    with open(pdf_path, 'rb') as file:
        reader = PyPDF2.PdfReader(file)
        num_pages = len(reader.pages)
        for page in range(num_pages):
            pdf_page = reader.pages[page]
            text += pdf_page.extract_text()
    return text

# 使用OCR識別文本
def ocr_text(image_path):
    text = pytesseract.image_to_string(image_path)
    return text

# 將文本保存為Excel文件
def save_text_as_excel(text, output_path):
    lines = text.split('\n')
    data = [line.split() for line in lines if line.strip()]
    df = pd.DataFrame(data)
    df.to_excel(output_path, index=False)

# 主函數(shù)
def pdf_to_excel(pdf_folder, output_folder):
    pdf_files = [f for f in os.listdir(pdf_folder) if f.endswith('.pdf')]

    for pdf_file in pdf_files:
        pdf_path = os.path.join(pdf_folder, pdf_file)
        text = pdf_to_text(pdf_path)

        # 使用OCR識別文本(如果需要)
        # image_path = 'image.png'  # 將PDF轉(zhuǎn)換為圖像文件(可選)
        # text = ocr_text(image_path)

        excel_file = pdf_file.replace('.pdf', '.xlsx')
        output_path = os.path.join(output_folder, excel_file)
        save_text_as_excel(text, output_path)

    print("轉(zhuǎn)換完成!")

# 調(diào)用函數(shù)進行轉(zhuǎn)換
pdf_folder = '/Users/liuhao/MyProject/PycharmProject/DataVisualization/Project1/Data/'
output_folder = '/Users/liuhao/MyProject/PycharmProject/DataVisualization/Project1/Output/'
pdf_to_excel(pdf_folder, output_folder)

大數(shù)據(jù)可視化作業(yè),【數(shù)據(jù)科學(xué)與大數(shù)據(jù)技術(shù)】,信息可視化,課程設(shè)計

  • 其他相關(guān)信息:
  • (104)山東理工大學(xué)2020計算機考研數(shù)據(jù)速覽
  • (189)山東理工大學(xué)2021計算機考研數(shù)據(jù)速覽,專碩復(fù)試線299分,學(xué)碩接收調(diào)劑
  • (112)山東理工大學(xué)22計算機考研數(shù)據(jù)速覽,學(xué)碩接收調(diào)劑

1.3 導(dǎo)師信息

通過山東理工大學(xué)計算機科學(xué)與技術(shù)學(xué)院官網(wǎng),搜集獲取研究生導(dǎo)師信息。

  • 獲取信息:姓名、職位、主要學(xué)習(xí)工作簡歷、主要研究方向、社會兼職及榮譽稱號、主講課程及主要教學(xué)獎勵、主要科研成果及獎勵
  • 爬取代碼:導(dǎo)師隊伍
import time
import requests
from lxml import etree
import pandas as pd

def scrape_website(url, dataframe):
    # 發(fā)起HTTP請求獲取網(wǎng)頁內(nèi)容
    response = requests.get(url)

    # 檢查請求是否成功
    if response.status_code == 200:
        # 使用lxml庫解析網(wǎng)頁內(nèi)容
        html = response.text
        tree = etree.HTML(html)

        # 創(chuàng)建字典來存儲爬取的數(shù)據(jù)
        data = {}

        # 基本信息
        item1 = tree.xpath('/html/body/div[4]/div/div[2]/div/div[1]/div[2]/h2//text()')
        item2 = tree.xpath('/html/body/div[4]/div/div[2]/div/div[1]/div[2]/h3//text()')
        data['Item 1'] = item1
        data['Item 2'] = item2

        # 主要學(xué)習(xí)工作簡歷
        data1 = tree.xpath('/html/body/div[4]/div/div[2]/div/div[2]/div/p//text()')
        data['Main Education and Work Experience'] = data1

        # 主要研究方向
        data2 = tree.xpath('/html/body/div[4]/div/div[2]/div/div[3]/div/p//text()')
        data['Main Research Areas'] = data2

        # 社會兼職及榮譽稱號
        data3 = tree.xpath('/html/body/div[4]/div/div[2]/div/div[4]/div/p//text()')
        data['Social Positions and Honors'] = data3

        # 主講課程及主要教學(xué)獎勵
        data4 = tree.xpath('/html/body/div[4]/div/div[2]/div/div[5]/div/p//text()')
        data['Main Courses and Teaching Awards'] = data4

        # 主要科研成果及獎勵
        data5 = tree.xpath('/html/body/div[4]/div/div[2]/div/div[6]/div/p//text()')
        data['Main Research Achievements and Awards'] = data5

        # 將數(shù)據(jù)轉(zhuǎn)換為DataFrame并添加到現(xiàn)有DataFrame中
        new_dataframe = pd.DataFrame([data])
        dataframe = pd.concat([dataframe, new_dataframe], ignore_index=True)

        return dataframe

    else:
        print("請求失敗")

def scrape_url(url):
    # 發(fā)起HTTP請求獲取網(wǎng)頁內(nèi)容
    response = requests.get(url)

    # 檢查請求是否成功
    if response.status_code == 200:
        # 使用lxml庫解析網(wǎng)頁內(nèi)容
        html = response.text
        tree = etree.HTML(html)
        # 提取所有鏈接
        links = tree.xpath('//*[@id="wp_content_w3_0"]//@href')
        for link in links:
            print("鏈接:", link)
        return links
    else:
        print("請求失敗")

# 創(chuàng)建空的DataFrame來存儲導(dǎo)師信息
df = pd.DataFrame()

# 調(diào)用爬蟲函數(shù)
links = scrape_url("https://jsjxy.sdut.edu.cn/7534/list.htm")
for link in links:
    print(link)
    df = scrape_website(link, df)
    time.sleep(1)

# 刪除JSON格式的數(shù)據(jù)
df = df.applymap(lambda x: ', '.join(x) if isinstance(x, list) else x)

# 將整理好的數(shù)據(jù)保存到Excel文件
df.to_excel("導(dǎo)師信息.xlsx", index=False)

print('########################### Over  ###########################')
  • 數(shù)據(jù)展示:
    大數(shù)據(jù)可視化作業(yè),【數(shù)據(jù)科學(xué)與大數(shù)據(jù)技術(shù)】,信息可視化,課程設(shè)計

二、預(yù)處理及分析

2.1 數(shù)據(jù)預(yù)處理

2.1.1 考研信息預(yù)處理

  • 刪除標題
  • 刪除空數(shù)據(jù)
  • 處理重復(fù)數(shù)據(jù)
  • 篩選復(fù)試學(xué)院為"計算機科學(xué)與技術(shù)數(shù)據(jù)" | “計算機學(xué)院” 的數(shù)據(jù)
  • 數(shù)據(jù)分別保存到三個Excel文件中,分別命名為“2020jsj”、“2021jsj”、“2022jsj”
import pandas as pd

# 讀取數(shù)據(jù)文件
data_path = "/Users/liuhao/MyProject/PycharmProject/DataVisualization/Project1/Data/"
file_names = ["2020year.xlsx", "2021year.xlsx", "2022year.xlsx"]
save_names = ["2020jsj.xlsx", "2021jsj.xlsx", "2022jsj.xlsx"]

for i in range(len(file_names)):
    file_path = data_path + file_names[i]
    save_path = data_path + save_names[i]

    # 讀取Excel文件
    df = pd.read_excel(file_path)

    # 篩選條件
    condition = ((df["復(fù)試學(xué)院"] == "計算機學(xué)院") | (df["復(fù)試學(xué)院"] == "計算機科學(xué)與技術(shù)學(xué)院"))

    # 根據(jù)條件篩選數(shù)據(jù)
    filtered_data = df[condition]

    # 保存篩選后的數(shù)據(jù)到新的Excel文件
    filtered_data.to_excel(save_path, index=False)

大數(shù)據(jù)可視化作業(yè),【數(shù)據(jù)科學(xué)與大數(shù)據(jù)技術(shù)】,信息可視化,課程設(shè)計

針對部分PDF轉(zhuǎn)Excel識別不規(guī)范處理:

  • 根據(jù)“序號”一列將所有數(shù)據(jù)添加到新的excel表格中,如果“序號”對應(yīng)的數(shù)據(jù)為非數(shù)字或空則跳過
import pandas as pd

# 讀取原始Excel文件
file_path = '/Users/liuhao/MyProject/PycharmProject/DataVisualization/Project1/Data/2020year.xlsx'
df = pd.read_excel(file_path)

# 新建Excel文件
new_file_path = '/Users/liuhao/MyProject/PycharmProject/DataVisualization/Project1/Data/new_data.xlsx'
new_df = pd.DataFrame(columns=df.columns)  # 使用原始Excel文件的表頭創(chuàng)建新的DataFrame

# 根據(jù)"序號"一列添加數(shù)據(jù)
for index, row in df.iterrows():
    value = row['序號']
    if pd.notnull(value) and str(value).isdigit():
        new_df = new_df._append(row)

# 將數(shù)據(jù)保存到新的Excel文件
new_df.to_excel(new_file_path, index=False)

2.1.2 導(dǎo)師信息預(yù)處理

  • 刪除空數(shù)據(jù)
  • 處理重復(fù)數(shù)據(jù)
  • 切分數(shù)據(jù)
import pandas as pd
import re

# 讀取Excel文件
file_path = '/Users/liuhao/MyProject/PycharmProject/DataVisualization/Project1/導(dǎo)師信息.xlsx'
df = pd.read_excel(file_path)

# 刪除空數(shù)據(jù)
df = df.dropna(how='all')

# 處理重復(fù)數(shù)據(jù)
df = df.drop_duplicates()

# 創(chuàng)建新的Excel文件
output_file = '/Users/liuhao/MyProject/PycharmProject/DataVisualization/Project1/導(dǎo)師信息處理后.xlsx'
writer = pd.ExcelWriter(output_file, engine='xlsxwriter')

# 處理每個導(dǎo)師的信息
for index, row in df.iterrows():
    # 獲取導(dǎo)師名稱
    teacher_name = row['Item 1']

    # 創(chuàng)建以導(dǎo)師名稱命名的工作表
    teacher_sheet = writer.book.add_worksheet(teacher_name)

    # 添加表頭信息
    headers = ['姓名', '職位', '主要學(xué)習(xí)工作簡歷', '主要研究方向', '社會兼職及榮譽稱號', '主講課程及主要教學(xué)獎勵',
               '主要科研成果及獎勵']
    for col_index, header in enumerate(headers):
        teacher_sheet.write(0, col_index, header)

    # 將每一列的數(shù)據(jù)按照“,”“、”“;”進行切分,并保存到新的工作表中
    for col_index, value in enumerate(row):
        if pd.notnull(value):
            data_list = [x.strip() for x in re.split('[,、;]', str(value))]
            for i, data in enumerate(data_list):
                teacher_sheet.write(i + 1, col_index, data)

# 保存并關(guān)閉Excel文件
writer._save()

  • 處理結(jié)果:
    大數(shù)據(jù)可視化作業(yè),【數(shù)據(jù)科學(xué)與大數(shù)據(jù)技術(shù)】,信息可視化,課程設(shè)計

預(yù)處理后的數(shù)據(jù)仍有部分存在,手工處理后獲得數(shù)據(jù)plus
數(shù)據(jù)內(nèi)容:姓名、職位、主要學(xué)習(xí)工作簡歷、主要研究方向、社會兼職及榮譽稱號、主講課程

2.2 數(shù)據(jù)分析


三、可視化方法及結(jié)果

3.1 可視化方法

  • 地理位置展示:pyecharts地圖展示工具
  • 2020-2022年一志愿錄取成績
    • 2020-2022年分數(shù)分布圖:初試成績、綜合面試成績、總成績(柱形圖)
    • 2020-2022年分數(shù)分分布餅圖:初試成績、綜合面試成績、總成績(餅圖-輪播圖)
    • 2020-2022年最低分、最高分對比:初試成績、綜合面試成績、總成績(箱線圖)
  • 2020-2022年一志愿人數(shù)信息:參與一志愿人數(shù)、錄取人數(shù)變化圖(折線圖)
  • 考試科目及內(nèi)容:Excel表格截圖
  • 專業(yè)師資隊伍:研究方向(關(guān)系圖+詞云圖)

3.2 可視化結(jié)果展示

3.2.1 基本信息

  • 地理位置
from pyecharts.charts import Geo
from pyecharts import options as opts
from pyecharts.globals import GeoType


def test_geo():
    g = Geo()
    # 選擇要顯示的地圖
    g.add_schema(maptype="山東")
    # 使用add_coordinate(name, lng, lat)添加坐標點和坐標名稱
    g.add_coordinate('山東理工大學(xué)', 117.999601, 36.810315)
    # 給上面的坐標點添加數(shù)據(jù),
    data_pair = [('山東理工大學(xué)', 10)]
    # 將數(shù)據(jù)添加到定義的地圖上
    g.add('', data_pair, type_=GeoType.EFFECT_SCATTER, symbol_size=5)
    # 設(shè)置樣式
    g.set_series_opts(label_opts=opts.LabelOpts(is_show=True))
    return g


g = test_geo()
# 渲染成html,保存在代碼文件的相同目錄下
g.render('坐標標注.html')

大數(shù)據(jù)可視化作業(yè),【數(shù)據(jù)科學(xué)與大數(shù)據(jù)技術(shù)】,信息可視化,課程設(shè)計

3.2.2 考研信息

2020-2022年分數(shù)分布圖:初試成績、綜合面試成績、總成績(柱形圖)

  • 初試成績分布
import pandas as pd
from pyecharts.charts import Bar
from pyecharts import options as opts

# 文件路徑和文件名
file_path = "/Users/liuhao/MyProject/PycharmProject/DataVisualization/Project1/Data/"
file_names = ["2020jsj.xlsx", "2021jsj.xlsx", "2022jsj.xlsx"]

# 分數(shù)段
score_ranges = [225, 250, 275, 300, 325, 350, 375, 400, 425]

# 存儲每個分數(shù)段的人數(shù)
score_counts = [[0] * (len(score_ranges) - 1) for _ in range(len(file_names))]

# 遍歷文件進行統(tǒng)計
for idx, file_name in enumerate(file_names):
    file = file_path + file_name
    df = pd.read_excel(file)

    # 獲取初試成績列數(shù)據(jù)
    scores = df["初試成績"]

    # 統(tǒng)計每個分數(shù)段的人數(shù)
    for score in scores:
        for i in range(len(score_ranges) - 1):
            if score_ranges[i] <= score < score_ranges[i + 1]:
                score_counts[idx][i] += 1
                break

# 繪制柱狀圖
bar = (
    Bar()
    .add_xaxis([str(range_start) + '-' + str(range_end) for range_start, range_end in zip(score_ranges[:-1], score_ranges[1:])])
)

# 添加不同年份的數(shù)據(jù)系列
for idx, file_name in enumerate(file_names):
    bar.add_yaxis(file_name[:-5], score_counts[idx], stack="stack{}".format(idx))

# 設(shè)置全局選項
bar.set_global_opts(
    title_opts=opts.TitleOpts(title="初試成績分布"),
    xaxis_opts=opts.AxisOpts(name="分數(shù)段"),
    yaxis_opts=opts.AxisOpts(name="人數(shù)"),
)

# 渲染圖表
bar.render("score_distribution.html")

大數(shù)據(jù)可視化作業(yè),【數(shù)據(jù)科學(xué)與大數(shù)據(jù)技術(shù)】,信息可視化,課程設(shè)計

  • 綜合面試成績分布
import pandas as pd
from pyecharts.charts import Bar
from pyecharts import options as opts

# 文件路徑和文件名
file_path = "/Users/liuhao/MyProject/PycharmProject/DataVisualization/Project1/Data/"
file_names = ["2020jsj.xlsx", "2021jsj.xlsx", "2022jsj.xlsx"]

# 分數(shù)段
score_ranges = list(range(70, 91, 2))

# 存儲每個分數(shù)段的人數(shù)
score_counts = [[0] * (len(score_ranges) - 1) for _ in range(len(file_names))]

# 遍歷文件進行統(tǒng)計
for idx, file_name in enumerate(file_names):
    file = file_path + file_name
    df = pd.read_excel(file)

    # 獲取綜合面試成績列數(shù)據(jù)
    scores = df["綜合面試成績"]

    # 統(tǒng)計每個分數(shù)段的人數(shù)
    for score in scores:
        for i in range(len(score_ranges) - 1):
            if score_ranges[i] <= score < score_ranges[i + 1]:
                score_counts[idx][i] += 1
                break

# 繪制柱狀圖
bar = (
    Bar()
    .add_xaxis([str(range_start) + '-' + str(range_end) for range_start, range_end in zip(score_ranges[:-1], score_ranges[1:])])
)

# 添加不同年份的數(shù)據(jù)系列
for idx, file_name in enumerate(file_names):
    bar.add_yaxis(file_name[:-5], score_counts[idx], stack="stack{}".format(idx))

# 設(shè)置全局選項
bar.set_global_opts(
    title_opts=opts.TitleOpts(title="綜合面試成績分布"),
    xaxis_opts=opts.AxisOpts(name="分數(shù)段"),
    yaxis_opts=opts.AxisOpts(name="人數(shù)"),
)

# 渲染圖表
bar.render("綜合面試成績分布.html")

大數(shù)據(jù)可視化作業(yè),【數(shù)據(jù)科學(xué)與大數(shù)據(jù)技術(shù)】,信息可視化,課程設(shè)計

  • 總成績分布
import pandas as pd
from pyecharts.charts import Bar
from pyecharts import options as opts

# 文件路徑和文件名
file_path = "/Users/liuhao/MyProject/PycharmProject/DataVisualization/Project1/Data/"
file_names = ["2020jsj.xlsx", "2021jsj.xlsx", "2022jsj.xlsx"]

# 分數(shù)段
score_ranges = list(range(60, 82, 2))

# 存儲每個分數(shù)段的人數(shù)
score_counts = [[0] * (len(score_ranges) - 1) for _ in range(len(file_names))]

# 遍歷文件進行統(tǒng)計
for idx, file_name in enumerate(file_names):
    file = file_path + file_name
    df = pd.read_excel(file)

    # 獲取總成績列數(shù)據(jù)
    total_scores = df["總成績"]

    # 統(tǒng)計每個分數(shù)段的人數(shù)
    for score in total_scores:
        for i in range(len(score_ranges) - 1):
            if score_ranges[i] <= score < score_ranges[i + 1]:
                score_counts[idx][i] += 1
                break

# 繪制柱狀圖
bar = (
    Bar()
    .add_xaxis([str(range_start) + '-' + str(range_end) for range_start, range_end in zip(score_ranges[:-1], score_ranges[1:])])
)

# 添加不同年份的數(shù)據(jù)系列
for idx, file_name in enumerate(file_names):
    bar.add_yaxis(file_name[:-5], score_counts[idx], stack="stack{}".format(idx))

# 設(shè)置全局選項
bar.set_global_opts(
    title_opts=opts.TitleOpts(title="總成績分布"),
    xaxis_opts=opts.AxisOpts(name="分數(shù)段"),
    yaxis_opts=opts.AxisOpts(name="人數(shù)"),
)

# 渲染圖表
bar.render("總成績分布.html")

大數(shù)據(jù)可視化作業(yè),【數(shù)據(jù)科學(xué)與大數(shù)據(jù)技術(shù)】,信息可視化,課程設(shè)計

2020-2022年分數(shù)分分布餅圖:初試成績、綜合面試成績、總成績(餅圖)

  • 初試成績
import pandas as pd
from pyecharts.charts import Pie, Timeline
from pyecharts import options as opts

# 文件路徑和文件名
file_path = "/Users/liuhao/MyProject/PycharmProject/DataVisualization/Project1/Data/"
file_names = ["2020jsj.xlsx", "2021jsj.xlsx", "2022jsj.xlsx"]

# 分數(shù)段
score_ranges = list(range(225, 425, 25))  # Updated score ranges

# 存儲每個分數(shù)段的人數(shù)
score_counts = [[0] * (len(score_ranges) - 1) for _ in range(len(file_names))]

# 遍歷文件進行統(tǒng)計
for idx, file_name in enumerate(file_names):
    file = file_path + file_name
    df = pd.read_excel(file)

    # 獲取初試成績列數(shù)據(jù)
    initial_scores = df["初試成績"]

    # 統(tǒng)計每個分數(shù)段的人數(shù)
    for score in initial_scores:
        for i in range(len(score_ranges) - 1):
            if score_ranges[i] <= score < score_ranges[i + 1]:
                score_counts[idx][i] += 1
                break

# 創(chuàng)建時間軸圖表
timeline = Timeline()

# 遍歷不同時間的數(shù)據(jù)
for idx, file_name in enumerate(file_names):
    # 創(chuàng)建餅圖
    pie = (
        Pie()
        .add(
            series_name="分數(shù)段",
            data_pair=[(str(range_start) + '-' + str(range_end), count) for range_start, range_end, count in zip(score_ranges[:-1], score_ranges[1:], score_counts[idx])],
            radius="50%"
        )
        .set_series_opts(label_opts=opts.LabelOpts(formatter=": {c}"))
        .set_global_opts(title_opts=opts.TitleOpts(title="初試成績分布"), legend_opts=opts.LegendOpts(orient="vertical", pos_top="15%", pos_right="2%"))
    )

    # 添加當前時間的圖表到時間軸
    timeline.add(pie, file_name[:-5])

# 渲染圖表
timeline.render("初試成績分布Pie.html")

大數(shù)據(jù)可視化作業(yè),【數(shù)據(jù)科學(xué)與大數(shù)據(jù)技術(shù)】,信息可視化,課程設(shè)計

  • 綜合面試成績
import pandas as pd
from pyecharts.charts import Pie, Timeline
from pyecharts import options as opts

# 文件路徑和文件名
file_path = "/Users/liuhao/MyProject/PycharmProject/DataVisualization/Project1/Data/"
file_names = ["2020jsj.xlsx", "2021jsj.xlsx", "2022jsj.xlsx"]

# 分數(shù)段
score_ranges = list(range(60, 91, 5))  # Updated score ranges

# 存儲每個分數(shù)段的人數(shù)
score_counts = [[0] * (len(score_ranges) - 1) for _ in range(len(file_names))]

# 遍歷文件進行統(tǒng)計
for idx, file_name in enumerate(file_names):
    file = file_path + file_name
    df = pd.read_excel(file)

    # 獲取綜合面試成績列數(shù)據(jù)
    interview_scores = df["綜合面試成績"]

    # 統(tǒng)計每個分數(shù)段的人數(shù)
    for score in interview_scores:
        for i in range(len(score_ranges) - 1):
            if score_ranges[i] <= score < score_ranges[i + 1]:
                score_counts[idx][i] += 1
                break

# 創(chuàng)建時間軸圖表
timeline = Timeline()

# 遍歷不同時間的數(shù)據(jù)
for idx, file_name in enumerate(file_names):
    # 創(chuàng)建餅圖
    pie = (
        Pie()
        .add(
            series_name="分數(shù)段",
            data_pair=[(str(range_start) + '-' + str(range_end), count) for range_start, range_end, count in zip(score_ranges[:-1], score_ranges[1:], score_counts[idx])],
            radius="50%"
        )
        .set_series_opts(label_opts=opts.LabelOpts(formatter=": {c}"))
        .set_global_opts(title_opts=opts.TitleOpts(title="綜合面試成績分布"), legend_opts=opts.LegendOpts(orient="vertical", pos_top="15%", pos_right="2%"))
    )

    # 添加當前時間的圖表到時間軸
    timeline.add(pie, file_name[:-5])

# 渲染圖表
timeline.render("綜合面試成績分布Pie.html")

大數(shù)據(jù)可視化作業(yè),【數(shù)據(jù)科學(xué)與大數(shù)據(jù)技術(shù)】,信息可視化,課程設(shè)計

  • 總成績
import pandas as pd
from pyecharts.charts import Pie, Timeline
from pyecharts import options as opts

# 文件路徑和文件名
file_path = "/Users/liuhao/MyProject/PycharmProject/DataVisualization/Project1/Data/"
file_names = ["2020jsj.xlsx", "2021jsj.xlsx", "2022jsj.xlsx"]

# 分數(shù)段
score_ranges = list(range(60, 80, 5))  # Updated score ranges

# 存儲每個分數(shù)段的人數(shù)
score_counts = [[0] * (len(score_ranges) - 1) for _ in range(len(file_names))]

# 遍歷文件進行統(tǒng)計
for idx, file_name in enumerate(file_names):
    file = file_path + file_name
    df = pd.read_excel(file)

    # 獲取總成績列數(shù)據(jù)
    total_scores = df["總成績"]

    # 統(tǒng)計每個分數(shù)段的人數(shù)
    for score in total_scores:
        for i in range(len(score_ranges) - 1):
            if score_ranges[i] <= score < score_ranges[i + 1]:
                score_counts[idx][i] += 1
                break

# 創(chuàng)建時間軸圖表
timeline = Timeline()

# 遍歷不同時間的數(shù)據(jù)
for idx, file_name in enumerate(file_names):
    # 創(chuàng)建餅圖
    pie = (
        Pie()
        .add(
            series_name="分數(shù)段",
            data_pair=[(str(range_start) + '-' + str(range_end), count) for range_start, range_end, count in zip(score_ranges[:-1], score_ranges[1:], score_counts[idx])],
            radius="50%"
        )
        .set_series_opts(label_opts=opts.LabelOpts(formatter=": {c}"))
        .set_global_opts(title_opts=opts.TitleOpts(title="總成績分布"), legend_opts=opts.LegendOpts(orient="vertical", pos_top="15%", pos_right="2%"))
    )

    # 添加當前時間的圖表到時間軸
    timeline.add(pie, file_name[:-5])

# 渲染圖表
timeline.render("總成績分布Pie.html")

大數(shù)據(jù)可視化作業(yè),【數(shù)據(jù)科學(xué)與大數(shù)據(jù)技術(shù)】,信息可視化,課程設(shè)計

2020-2022年一志愿人數(shù)信息:參與一志愿人數(shù)、錄取人數(shù)變化圖(折線圖)

import pandas as pd
from pyecharts import options as opts
from pyecharts.charts import Line

# 讀取Excel文件
df_2020 = pd.read_excel('/Users/liuhao/MyProject/PycharmProject/DataVisualization/Project1/Data/2020jsj.xlsx')
df_2021 = pd.read_excel('/Users/liuhao/MyProject/PycharmProject/DataVisualization/Project1/Data/2021jsj.xlsx')
df_2022 = pd.read_excel('/Users/liuhao/MyProject/PycharmProject/DataVisualization/Project1/Data/2022jsj.xlsx')

# 計算總?cè)藬?shù)和錄取人數(shù)
total_counts = [len(df_2020), len(df_2021), len(df_2022)]
admitted_counts = [
    len(df_2020[df_2020['錄取結(jié)果'] == '擬錄取']),
    len(df_2021[df_2021['錄取結(jié)果'] == '擬錄取']),
    len(df_2022[df_2022['錄取結(jié)果'] == '擬錄取'])
]

# 創(chuàng)建折線圖
line = (
    Line()
    .add_xaxis(['2020', '2021', '2022'])
    .add_yaxis('總?cè)藬?shù)', total_counts, markline_opts=opts.MarkLineOpts(data=[opts.MarkLineItem(type_="average")]))
    .add_yaxis('錄取人數(shù)', admitted_counts, markline_opts=opts.MarkLineOpts(data=[opts.MarkLineItem(type_="average")]))
    .set_global_opts(title_opts=opts.TitleOpts(title='總?cè)藬?shù)和錄取人數(shù)變化折線圖'),
                     yaxis_opts=opts.AxisOpts(name='人數(shù)'),
                     xaxis_opts=opts.AxisOpts(name='年份'))
)

# 保存為HTML文件并在瀏覽器中打開
line.render('/Users/liuhao/MyProject/PycharmProject/DataVisualization/Project1/錄取人數(shù)變化.html')

大數(shù)據(jù)可視化作業(yè),【數(shù)據(jù)科學(xué)與大數(shù)據(jù)技術(shù)】,信息可視化,課程設(shè)計

2020-2022年最低分、最高分對比:初試成績、綜合面試成績、總成績(箱線圖)

import pandas as pd
import matplotlib.pyplot as plt

# 設(shè)置中文字體
plt.rcParams['font.sans-serif'] = 'SimHei'

# 讀取數(shù)據(jù)
data_2020 = pd.read_excel('/Users/liuhao/MyProject/PycharmProject/DataVisualization/Project1/Data/2020jsj.xlsx').dropna()
data_2021 = pd.read_excel('/Users/liuhao/MyProject/PycharmProject/DataVisualization/Project1/Data/2021jsj.xlsx').dropna()
data_2022 = pd.read_excel('/Users/liuhao/MyProject/PycharmProject/DataVisualization/Project1/Data/2022jsj.xlsx').dropna()

# 提取所需的列數(shù)據(jù)
score_2020 = data_2020['初試成績']
score_2021 = data_2021['初試成績']
score_2022 = data_2022['初試成績']

interview_2020 = data_2020['綜合面試成績']
interview_2021 = data_2021['綜合面試成績']
interview_2022 = data_2022['綜合面試成績']

total_2020 = data_2020['總成績']
total_2021 = data_2021['總成績']
total_2022 = data_2022['總成績']

# 繪制箱線圖
plt.figure(figsize=(10, 6))

# 初試成績對比圖
plt.subplot(1, 3, 1)
plt.boxplot([score_2020, score_2021, score_2022])
plt.xticks([1, 2, 3], ['2020', '2021', '2022'])
plt.title('初試成績')

# 綜合面試成績對比圖
plt.subplot(1, 3, 2)
plt.boxplot([interview_2020, interview_2021, interview_2022])
plt.xticks([1, 2, 3], ['2020', '2021', '2022'])
plt.title('綜合面試成績')

# 總成績對比圖
plt.subplot(1, 3, 3)
plt.boxplot([total_2020, total_2021, total_2022])
plt.xticks([1, 2, 3], ['2020', '2021', '2022'])
plt.title('總成績')

plt.tight_layout()
plt.show()


大數(shù)據(jù)可視化作業(yè),【數(shù)據(jù)科學(xué)與大數(shù)據(jù)技術(shù)】,信息可視化,課程設(shè)計

3.2.3 導(dǎo)師信息

  • 導(dǎo)師對應(yīng)研究方向
import pandas as pd
import networkx as nx
import matplotlib.pyplot as plt
# 設(shè)置中文字體
plt.rcParams['font.sans-serif'] = 'SimHei'

# 讀取Excel文件
file_path = '/Users/liuhao/MyProject/PycharmProject/DataVisualization/Project1/Data/導(dǎo)師信息處理plus.xlsx'
df = pd.read_excel(file_path, sheet_name=None)

# 創(chuàng)建空的有向圖
graph = nx.DiGraph()

# 添加導(dǎo)師和研究方向節(jié)點
for sheet_name, sheet_data in df.items():
    tutor_name = sheet_name
    research_directions = sheet_data['主要研究方向'].dropna().tolist()

    # 添加導(dǎo)師節(jié)點
    graph.add_node(tutor_name, node_type='tutor')

    # 添加研究方向節(jié)點
    for direction in research_directions:
        graph.add_node(direction, node_type='research_direction')

        # 添加導(dǎo)師與研究方向之間的邊
        graph.add_edge(tutor_name, direction)

# 繪制關(guān)系圖
plt.figure(figsize=(12, 8))
pos = nx.spring_layout(graph, seed=42)
node_colors = {'tutor': 'lightblue', 'research_direction': 'lightgreen'}

nx.draw_networkx_nodes(graph, pos, node_color=[node_colors[graph.nodes[node]['node_type']] for node in graph.nodes()])
nx.draw_networkx_labels(graph, pos, font_size=10, font_color='black')
nx.draw_networkx_edges(graph, pos, arrowstyle='->', arrowsize=10)

plt.axis('off')
plt.show()

大數(shù)據(jù)可視化作業(yè),【數(shù)據(jù)科學(xué)與大數(shù)據(jù)技術(shù)】,信息可視化,課程設(shè)計

  • 研究方向詞云圖
import pandas as pd
from collections import Counter
from pyecharts import options as opts
from pyecharts.charts import WordCloud

# 讀取Excel文件
file_path = '/Users/liuhao/MyProject/PycharmProject/DataVisualization/Project1/Data/導(dǎo)師信息處理plus.xlsx'
df = pd.read_excel(file_path, sheet_name=None)

# 統(tǒng)計研究方向出現(xiàn)的次數(shù)
research_directions = []
for sheet_name, sheet_data in df.items():
    research_directions.extend(sheet_data['主要研究方向'].dropna().tolist())

research_direction_counts = Counter(research_directions)

# 生成詞云圖數(shù)據(jù)
wordcloud_data = [(key, value) for key, value in research_direction_counts.items()]

# 創(chuàng)建詞云圖
wordcloud = (
    WordCloud()
    .add(series_name="研究方向", data_pair=wordcloud_data, word_size_range=[20, 100])
    .set_global_opts(title_opts=opts.TitleOpts(title="研究方向詞云圖"))
)

# 渲染詞云圖到HTML文件中
wordcloud.render("wordcloud.html")

大數(shù)據(jù)可視化作業(yè),【數(shù)據(jù)科學(xué)與大數(shù)據(jù)技術(shù)】,信息可視化,課程設(shè)計


四、總結(jié)

本項目使用Python網(wǎng)絡(luò)爬蟲、Pandas、Pyecharts、matplotlib等工具完成對山東理工大學(xué)計算機科學(xué)與技術(shù)專業(yè)考研信息及導(dǎo)師信息的手機與展示。展現(xiàn)了2020-2022年共三年該專業(yè)的考研錄取信息并進行分析,
通過本項目,熟練掌握了對網(wǎng)絡(luò)數(shù)據(jù)的爬取,數(shù)據(jù)的可視化展示,能夠熟練運用Pandas等數(shù)據(jù)處理工具對數(shù)據(jù)進行簡單預(yù)處理,能夠熟練使用pyecharts、matplotlib等數(shù)據(jù)可視化工具,通過使用柱狀圖、折線圖、餅圖、箱線圖、關(guān)系圖、詞云圖等展示形式,對數(shù)據(jù)進行可視化展示。文章來源地址http://www.zghlxwxcb.cn/news/detail-520365.html


五、附錄

到了這里,關(guān)于【數(shù)據(jù)可視化】大作業(yè)(意向考研高校的數(shù)據(jù)可視化)的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務(wù),不擁有所有權(quán),不承擔相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實不符,請點擊違法舉報進行投訴反饋,一經(jīng)查實,立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費用

相關(guān)文章

  • python庫,科學(xué)計算與數(shù)據(jù)可視化基礎(chǔ),知識筆記(numpy+matplotlib)

    python庫,科學(xué)計算與數(shù)據(jù)可視化基礎(chǔ),知識筆記(numpy+matplotlib)

    這篇主要講一下數(shù)據(jù)處理中科學(xué)計算部分的知識。 之前有一篇pandas處理數(shù)據(jù)的。 講一下這幾個庫的區(qū)別。 Pandas主要用來處理類表格數(shù)據(jù)(excel,csv),提供了計算接口,可用Numpy或其它方式進行計算。 NumPy 主要用來處理數(shù)值數(shù)據(jù)(尤其是矩陣,向量為核心的),本質(zhì)上是純

    2024年02月02日
    瀏覽(33)
  • 智能科學(xué)畢設(shè)分享(含算法) python大數(shù)據(jù)房價預(yù)測與可視化系統(tǒng)

    智能科學(xué)畢設(shè)分享(含算法) python大數(shù)據(jù)房價預(yù)測與可視化系統(tǒng)

    # 0 簡介 今天學(xué)長向大家介紹一個適合作為畢設(shè)的項目 畢設(shè)分享 python大數(shù)據(jù)房價預(yù)測與可視化系統(tǒng) 項目獲取: https://gitee.com/sinonfin/algorithm-sharing 1.需求描述 對于數(shù)據(jù)挖掘工程師來說,有時候需要抓取地理位置信息,比如統(tǒng)計房子周邊基礎(chǔ)設(shè)施信息,比如醫(yī)院、公交車站、寫

    2024年02月03日
    瀏覽(27)
  • 大數(shù)據(jù)作業(yè):相親數(shù)據(jù)的可視化分析(個人)

    大數(shù)據(jù)作業(yè):相親數(shù)據(jù)的可視化分析(個人)

    個人大數(shù)據(jù)的期末大作業(yè),用python按城市尋找爬取、分析和保存了珍愛網(wǎng)相親的征婚信息,然后進行數(shù)據(jù)可視化分析。 網(wǎng)站來源如下 1.數(shù)據(jù)的清洗 分析數(shù)據(jù)中用到了正則表達式查找篩選指定字符串。但因為珍愛網(wǎng)的每一欄都是采用相同的標簽和class,這樣就不知道是在哪里結(jié)

    2024年02月03日
    瀏覽(13)
  • 數(shù)據(jù)分析與可視化(python大作業(yè))

    數(shù)據(jù)分析與可視化(python大作業(yè))

    目錄 涉及知識 自動打開想要獲取到數(shù)據(jù)的頁面 繪制統(tǒng)計圖 初步設(shè)計過程 自動化測試 所需數(shù)據(jù)包 初步過程分析 爬取數(shù)據(jù) 所需數(shù)據(jù)包 初步過程分析 數(shù)據(jù)分析與可視化(繪圖) 所需數(shù)據(jù)包 各類統(tǒng)計圖簡介: 詳細設(shè)計過程 導(dǎo)入所有數(shù)據(jù)包與數(shù)據(jù)集 數(shù)據(jù)分析 數(shù)據(jù)情況預(yù)覽 數(shù)

    2024年02月12日
    瀏覽(21)
  • b站爬蟲大作業(yè)(大二)--(利用selenium模塊爬取數(shù)據(jù)、利用pyecharts模塊制作可視化圖表)(bilibili數(shù)據(jù)可視化)

    b站爬蟲大作業(yè)(大二)--(利用selenium模塊爬取數(shù)據(jù)、利用pyecharts模塊制作可視化圖表)(bilibili數(shù)據(jù)可視化)

    一、爬取前期準備工作 二、爬取目標 三、爬取過程(重點) 四、生成可視化圖表 1.安裝selenium模塊及其相關(guān)驅(qū)動 安裝selenium模塊(以PyCharm為例) 方法一:打開PyCharm,依次點擊 “文件”---“設(shè)置”---“python解釋器”---選擇適合的環(huán)境(環(huán)境可以自己新建,也可以使用基礎(chǔ)環(huán)境

    2024年02月22日
    瀏覽(26)
  • 【全程記錄】一次數(shù)據(jù)分析和可視化的大作業(yè)(python)

    【全程記錄】一次數(shù)據(jù)分析和可視化的大作業(yè)(python)

    本帖記錄了一次從頭到尾的作業(yè)過程(從導(dǎo)入數(shù)據(jù)集,經(jīng)過數(shù)據(jù)處理與分析,到可視化數(shù)據(jù),再到最終總結(jié)。包括遇到的問題與解決辦法),其中運用到的知識來源于學(xué)校老師和bilibili教學(xué)視頻,其中教學(xué)視頻如下: 【【莫煩Python】Matplotlib Python 畫圖教程】 https://www.bilibili

    2024年02月04日
    瀏覽(54)
  • 爬蟲+數(shù)據(jù)分析+可視化大作業(yè):基于大數(shù)據(jù)的高質(zhì)量電影分析報告

    爬蟲+數(shù)據(jù)分析+可視化大作業(yè):基于大數(shù)據(jù)的高質(zhì)量電影分析報告

    主要目的是為了學(xué)習(xí)Scrapy與Sklearn而不是寫論文,結(jié)論是瞎扯的,輕噴求求了 在我們的日常生活中,電影已經(jīng)成為了我們娛樂放松活動所不可缺少的元素。然而,自電影誕生以來,人們每天都在生產(chǎn)著電影,卻又生產(chǎn)著質(zhì)量良莠不齊的電影。在這些幾乎是無窮無盡的電影洪流

    2024年02月03日
    瀏覽(47)
  • 內(nèi)容更新版:AI大模型智能大氣科學(xué)探索之:ChatGPT在大氣科學(xué)領(lǐng)域建模、數(shù)據(jù)分析、可視化與資源評估中的高效應(yīng)用及論文寫作

    內(nèi)容更新版:AI大模型智能大氣科學(xué)探索之:ChatGPT在大氣科學(xué)領(lǐng)域建模、數(shù)據(jù)分析、可視化與資源評估中的高效應(yīng)用及論文寫作

    深度探討人工智能在大氣科學(xué)中的應(yīng)用,特別是如何結(jié)合最新AI模型與Python技術(shù)處理和分析氣候數(shù)據(jù)。課程介紹包括GPT-4等先進AI工具,旨在大家掌握這些工具的功能及應(yīng)用范圍。內(nèi)容覆蓋使用GPT處理數(shù)據(jù)、生成論文摘要、文獻綜述、技術(shù)方法分析等實戰(zhàn)案例,使學(xué)員能夠?qū)?/p>

    2024年04月10日
    瀏覽(20)
  • 智慧農(nóng)業(yè):溫室大棚物聯(lián)網(wǎng)系統(tǒng),助力實現(xiàn)可視化科學(xué)管理

    智慧農(nóng)業(yè):溫室大棚物聯(lián)網(wǎng)系統(tǒng),助力實現(xiàn)可視化科學(xué)管理

    我國傳統(tǒng)農(nóng)業(yè)的特點是靠天吃飯,而智慧農(nóng)業(yè)發(fā)端于物聯(lián)網(wǎng)設(shè)備和對應(yīng)的農(nóng)業(yè)信息化管理系統(tǒng),是利用數(shù)字技術(shù)、數(shù)據(jù)分析和人工智能等先進技術(shù)手段,對農(nóng)業(yè)生產(chǎn)進行精細化管理和智能化決策的一種新型農(nóng)業(yè)生產(chǎn)模式。它可以通過實時監(jiān)測、預(yù)測和調(diào)控土壤、氣象、水文、

    2024年02月13日
    瀏覽(23)
  • Python基于Flask的高校輿情分析,輿情監(jiān)控可視化系統(tǒng)

    Python基于Flask的高校輿情分析,輿情監(jiān)控可視化系統(tǒng)

    目錄 一、前言 二、使用Python爬取輿情數(shù)據(jù) 1.安裝requests庫 2.分析數(shù)據(jù) 3.爬取數(shù)據(jù) 三、通過代理IP提高數(shù)據(jù)爬取效率 1.獲取代理IP 2.使用代理IP 四、使用Flask框架實現(xiàn)輿情監(jiān)控可視化系統(tǒng) 五、使用MongoDB存儲數(shù)據(jù) 六、總結(jié) 一、前言 在當今社會,輿情監(jiān)控越來越被重視。隨著互聯(lián)

    2024年02月07日
    瀏覽(18)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包