【数据分析】基于大数据的学生习惯数据可视化分析系统 | 大数据选题推荐 大数据实战项目 可视化大屏 Hadoop SPark java Python

33 阅读6分钟

💖💖作者:计算机毕业设计江挽 💙💙个人简介:曾长期从事计算机专业培训教学,本人也热爱上课教学,语言擅长Java、微信小程序、Python、Golang、安卓Android等,开发项目包括大数据、深度学习、网站、小程序、安卓、算法。平常会做一些项目定制化开发、代码讲解、答辩教学、文档编写、也懂一些降重方面的技巧。平常喜欢分享一些自己开发中遇到的问题的解决办法,也喜欢交流技术,大家有技术代码这一块的问题可以问我! 💛💛想说的话:感谢大家的关注与支持! 💜💜 网站实战项目 安卓/小程序实战项目 大数据实战项目 深度学习实战项目

基于大数据的学生习惯数据可视化分析系统介绍

基于大数据的学生习惯数据可视化分析系统是一套面向教育机构的智能化数据分析平台,该系统采用Hadoop分布式存储架构结合Spark大数据计算引擎,能够高效处理海量学生行为数据。系统前端采用Vue+ElementUI+Echarts技术栈构建交互界面,后端提供Python Django和Java SpringBoot双版本实现方案,底层数据存储基于MySQL数据库,并通过HDFS实现分布式文件管理。核心功能涵盖系统首页展示、个人信息管理、系统管理模块以及学生多维分析四大板块,其中学生多维分析模块整合了Spark SQL、Pandas、NumPy等数据处理工具,能够从时间维度、行为类型、频次分布等多个角度对学生习惯数据进行深度挖掘,并通过Echarts图表组件将分析结果以柱状图、折线图、饼图等多种可视化形式呈现,帮助教育管理者直观掌握学生群体的学习规律和行为特征,为教学决策提供数据支撑。

基于大数据的学生习惯数据可视化分析系统演示视频

演示视频

基于大数据的学生习惯数据可视化分析系统演示图片

在这里插入图片描述 在这里插入图片描述 在这里插入图片描述 在这里插入图片描述 在这里插入图片描述 在这里插入图片描述 在这里插入图片描述 在这里插入图片描述

基于大数据的学生习惯数据可视化分析系统代码展示

from pyspark.sql import SparkSession
from pyspark.sql.functions import col, count, avg, sum, date_format, hour, dayofweek
from pyspark.sql.types import StructType, StructField, StringType, IntegerType, TimestampType, DoubleType
import pandas as pd
import numpy as np
from django.http import JsonResponse
from django.views.decorators.http import require_http_methods
import json
from datetime import datetime, timedelta

spark = SparkSession.builder.appName("StudentHabitAnalysis").config("spark.sql.warehouse.dir", "/user/hive/warehouse").config("spark.executor.memory", "2g").config("spark.driver.memory", "1g").getOrCreate()

@require_http_methods(["POST"])
def analyze_student_time_distribution(request):
    data = json.loads(request.body)
    start_date = data.get('start_date')
    end_date = data.get('end_date')
    habit_type = data.get('habit_type')
    df = spark.read.format("jdbc").option("url", "jdbc:mysql://localhost:3306/student_system").option("driver", "com.mysql.cj.jdbc.Driver").option("dbtable", "student_habit_records").option("user", "root").option("password", "123456").load()
    filtered_df = df.filter((col("record_time") >= start_date) & (col("record_time") <= end_date))
    if habit_type and habit_type != 'all':
        filtered_df = filtered_df.filter(col("habit_type") == habit_type)
    filtered_df = filtered_df.withColumn("hour", hour(col("record_time")))
    filtered_df = filtered_df.withColumn("weekday", dayofweek(col("record_time")))
    hourly_stats = filtered_df.groupBy("hour").agg(count("*").alias("count"), avg("duration").alias("avg_duration")).orderBy("hour")
    hourly_result = hourly_stats.toPandas()
    hourly_result['avg_duration'] = hourly_result['avg_duration'].round(2)
    weekday_stats = filtered_df.groupBy("weekday").agg(count("*").alias("count"), sum("duration").alias("total_duration")).orderBy("weekday")
    weekday_result = weekday_stats.toPandas()
    weekday_mapping = {1: '周日', 2: '周一', 3: '周二', 4: '周三', 5: '周四', 6: '周五', 7: '周六'}
    weekday_result['weekday'] = weekday_result['weekday'].map(weekday_mapping)
    peak_hours = hourly_result.nlargest(3, 'count')['hour'].tolist()
    total_records = int(filtered_df.count())
    avg_daily_count = total_records / ((datetime.strptime(end_date, '%Y-%m-%d') - datetime.strptime(start_date, '%Y-%m-%d')).days + 1)
    response_data = {'hourly_distribution': hourly_result.to_dict('records'),'weekday_distribution': weekday_result.to_dict('records'),'peak_hours': peak_hours,'total_records': total_records,'avg_daily_count': round(avg_daily_count, 2),'analysis_period': f"{start_date}{end_date}"}
    return JsonResponse(response_data, safe=False)

@require_http_methods(["POST"])
def analyze_student_habit_categories(request):
    data = json.loads(request.body)
    student_grade = data.get('student_grade')
    student_major = data.get('student_major')
    df = spark.read.format("jdbc").option("url", "jdbc:mysql://localhost:3306/student_system").option("driver", "com.mysql.cj.jdbc.Driver").option("dbtable", "student_habit_records").option("user", "root").option("password", "123456").load()
    student_df = spark.read.format("jdbc").option("url", "jdbc:mysql://localhost:3306/student_system").option("driver", "com.mysql.cj.jdbc.Driver").option("dbtable", "student_info").option("user", "root").option("password", "123456").load()
    joined_df = df.join(student_df, df.student_id == student_df.id, "inner")
    if student_grade:
        joined_df = joined_df.filter(col("grade") == student_grade)
    if student_major:
        joined_df = joined_df.filter(col("major") == student_major)
    category_stats = joined_df.groupBy("habit_type").agg(count("*").alias("count"),avg("duration").alias("avg_duration"),sum("duration").alias("total_duration")).orderBy(col("count").desc())
    category_result = category_stats.toPandas()
    total_count = category_result['count'].sum()
    category_result['percentage'] = (category_result['count'] / total_count * 100).round(2)
    category_result['avg_duration'] = category_result['avg_duration'].round(2)
    top_categories = category_result.head(5)
    student_habit_distribution = joined_df.groupBy("student_id", "habit_type").agg(count("*").alias("habit_count"))
    student_diversity = student_habit_distribution.groupBy("student_id").agg(count("habit_type").alias("habit_variety"))
    avg_variety = float(student_diversity.agg(avg("habit_variety")).collect()[0][0])
    habit_correlation_df = joined_df.select("student_id", "habit_type").distinct()
    habit_pairs = habit_correlation_df.alias("a").join(habit_correlation_df.alias("b"),(col("a.student_id") == col("b.student_id")) & (col("a.habit_type") < col("b.habit_type")),"inner").groupBy("a.habit_type", "b.habit_type").agg(count("*").alias("co_occurrence")).orderBy(col("co_occurrence").desc()).limit(5)
    correlation_result = habit_pairs.toPandas()
    response_data = {'category_distribution': category_result.to_dict('records'),'top_5_categories': top_categories[['habit_type', 'count', 'percentage']].to_dict('records'),'avg_habit_variety': round(avg_variety, 2),'habit_correlations': correlation_result.to_dict('records'),'filter_conditions': {'grade': student_grade, 'major': student_major}}
    return JsonResponse(response_data, safe=False)

@require_http_methods(["POST"])
def analyze_student_behavior_trends(request):
    data = json.loads(request.body)
    student_id = data.get('student_id')
    trend_type = data.get('trend_type', 'monthly')
    df = spark.read.format("jdbc").option("url", "jdbc:mysql://localhost:3306/student_system").option("driver", "com.mysql.cj.jdbc.Driver").option("dbtable", "student_habit_records").option("user", "root").option("password", "123456").load()
    if student_id:
        df = df.filter(col("student_id") == student_id)
    if trend_type == 'monthly':
        df = df.withColumn("time_period", date_format(col("record_time"), "yyyy-MM"))
    elif trend_type == 'weekly':
        df = df.withColumn("time_period", date_format(col("record_time"), "yyyy-ww"))
    else:
        df = df.withColumn("time_period", date_format(col("record_time"), "yyyy-MM-dd"))
    trend_stats = df.groupBy("time_period", "habit_type").agg(count("*").alias("count"),sum("duration").alias("total_duration"),avg("duration").alias("avg_duration")).orderBy("time_period", "habit_type")
    trend_result = trend_stats.toPandas()
    trend_result['avg_duration'] = trend_result['avg_duration'].round(2)
    overall_trend = df.groupBy("time_period").agg(count("*").alias("total_count"),sum("duration").alias("period_total_duration")).orderBy("time_period")
    overall_result = overall_trend.toPandas()
    if len(overall_result) > 1:
        overall_result['growth_rate'] = overall_result['total_count'].pct_change() * 100
        overall_result['growth_rate'] = overall_result['growth_rate'].round(2)
    habit_type_trends = {}
    for habit in trend_result['habit_type'].unique():
        habit_data = trend_result[trend_result['habit_type'] == habit][['time_period', 'count']].values.tolist()
        habit_type_trends[habit] = habit_data
    pandas_df = trend_result[['time_period', 'count']].copy()
    pandas_df['time_period'] = pd.to_datetime(pandas_df['time_period'])
    pandas_df = pandas_df.set_index('time_period')
    if len(pandas_df) >= 3:
        moving_avg = pandas_df['count'].rolling(window=3).mean().round(2)
        trend_result['moving_avg'] = moving_avg.values
    active_periods = overall_result.nlargest(3, 'total_count')['time_period'].tolist()
    inactive_periods = overall_result.nsmallest(3, 'total_count')['time_period'].tolist()
    response_data = {'detailed_trends': trend_result.to_dict('records'),'overall_trend': overall_result.to_dict('records'),'habit_type_trends': habit_type_trends,'most_active_periods': active_periods,'least_active_periods': inactive_periods,'trend_type': trend_type,'student_id': student_id}
    return JsonResponse(response_data, safe=False)

基于大数据的学生习惯数据可视化分析系统文档展示

在这里插入图片描述

💖💖作者:计算机毕业设计江挽 💙💙个人简介:曾长期从事计算机专业培训教学,本人也热爱上课教学,语言擅长Java、微信小程序、Python、Golang、安卓Android等,开发项目包括大数据、深度学习、网站、小程序、安卓、算法。平常会做一些项目定制化开发、代码讲解、答辩教学、文档编写、也懂一些降重方面的技巧。平常喜欢分享一些自己开发中遇到的问题的解决办法,也喜欢交流技术,大家有技术代码这一块的问题可以问我! 💛💛想说的话:感谢大家的关注与支持! 💜💜 网站实战项目 安卓/小程序实战项目 大数据实战项目 深度学习实战项目