💖💖作者:计算机编程小咖 💙💙个人简介:曾长期从事计算机专业培训教学,本人也热爱上课教学,语言擅长Java、微信小程序、Python、Golang、安卓Android等,开发项目包括大数据、深度学习、网站、小程序、安卓、算法。平常会做一些项目定制化开发、代码讲解、答辩教学、文档编写、也懂一些降重方面的技巧。平常喜欢分享一些自己开发中遇到的问题的解决办法,也喜欢交流技术,大家有技术代码这一块的问题可以问我! 💛💛想说的话:感谢大家的关注与支持! 💜💜 网站实战项目 安卓/小程序实战项目 大数据实战项目 深度学习实战项目
@TOC
基于大数据的化妆品数据可视化分析系统介绍
《基于大数据的化妆品数据可视化分析系统》是一套采用现代大数据技术栈构建的综合性数据分析平台,系统底层基于Hadoop分布式文件系统(HDFS)进行海量化妆品数据的存储管理,利用Apache Spark框架实现大规模数据的并行处理和分析计算,通过Spark SQL提供高效的数据查询能力,结合Pandas和NumPy进行深度数据挖掘和统计分析。系统采用前后端分离架构,后端支持Django和Spring Boot双技术栈实现,提供稳定的RESTful API服务,前端基于Vue.js框架配合ElementUI组件库构建现代化用户界面,集成Echarts图表库实现丰富的数据可视化展示效果。系统核心功能涵盖化妆品市场的全方位数据分析,包括数据大屏可视化总览、品牌产品数量与广度分析、品类平均价格与评分分析、化妆品品类分布统计、品类敏感肌专注度评估、热门化妆品成分深度分析、化妆品价格区间分布研究、价格评分聚类分析、价格评分相关性分析、化妆品评分分布分析、不同肤质覆盖率统计、主流品牌均价对比分析、主流品牌口碑分析以及热门品牌敏感肌友好度评估等15项核心分析功能,同时提供完善的用户管理模块包括系统首页、个人信息管理、密码修改和系统介绍等基础功能,整个系统通过MySQL数据库存储结构化数据,形成了一套完整的化妆品行业大数据分析解决方案。
基于大数据的化妆品数据可视化分析系统演示视频
基于大数据的化妆品数据可视化分析系统演示图片
基于大数据的化妆品数据可视化分析系统代码展示
from pyspark.sql import SparkSession
from pyspark.sql.functions import col, count, sum, avg, explode, split, regexp_replace, when, desc
from pyspark.sql.types import StructType, StructField, StringType, DoubleType, IntegerType
import pandas as pd
import numpy as np
spark = SparkSession.builder.appName("CosmeticsDataAnalysis").config("spark.sql.adaptive.enabled", "true").config("spark.sql.adaptive.coalescePartitions.enabled", "true").getOrCreate()
def analyze_brand_product_count():
cosmetics_df = spark.read.option("header", "true").csv("hdfs://localhost:9000/cosmetics_data/products.csv")
cosmetics_df = cosmetics_df.filter(col("brand").isNotNull() & (col("brand") != ""))
brand_count_df = cosmetics_df.groupBy("brand").agg(count("product_id").alias("product_count"))
brand_count_df = brand_count_df.orderBy(desc("product_count"))
top_brands = brand_count_df.limit(20)
brand_stats = top_brands.agg(avg("product_count").alias("avg_count"), sum("product_count").alias("total_count")).collect()[0]
result_data = []
for row in top_brands.collect():
brand_name = row["brand"]
product_count = row["product_count"]
market_share = round((product_count / brand_stats["total_count"]) * 100, 2)
result_data.append({"brand": brand_name, "count": product_count, "market_share": market_share})
total_brands = cosmetics_df.select("brand").distinct().count()
analysis_summary = {"total_brands": total_brands, "avg_products_per_brand": round(brand_stats["avg_count"], 2), "top_brand_data": result_data}
return analysis_summary
def analyze_price_distribution():
price_df = spark.read.option("header", "true").csv("hdfs://localhost:9000/cosmetics_data/products.csv")
price_df = price_df.filter(col("price").isNotNull() & (col("price") > 0))
price_df = price_df.withColumn("price", col("price").cast(DoubleType()))
price_ranges = price_df.withColumn("price_range", when(col("price") <= 50, "0-50元").when((col("price") > 50) & (col("price") <= 100), "51-100元").when((col("price") > 100) & (col("price") <= 200), "101-200元").when((col("price") > 200) & (col("price") <= 500), "201-500元").otherwise("500元以上"))
range_distribution = price_ranges.groupBy("price_range").agg(count("product_id").alias("product_count"), avg("price").alias("avg_price"))
total_products = price_df.count()
range_stats = range_distribution.withColumn("percentage", (col("product_count") / total_products * 100))
range_results = []
for row in range_stats.collect():
range_name = row["price_range"]
count = row["product_count"]
avg_price = round(row["avg_price"], 2)
percentage = round(row["percentage"], 2)
range_results.append({"range": range_name, "count": count, "avg_price": avg_price, "percentage": percentage})
overall_stats = price_df.agg(avg("price").alias("overall_avg"), count("product_id").alias("total_count")).collect()[0]
distribution_result = {"price_ranges": range_results, "overall_avg_price": round(overall_stats["overall_avg"], 2), "total_products": overall_stats["total_count"]}
return distribution_result
def analyze_popular_ingredients():
ingredients_df = spark.read.option("header", "true").csv("hdfs://localhost:9000/cosmetics_data/products.csv")
ingredients_df = ingredients_df.filter(col("ingredients").isNotNull() & (col("ingredients") != ""))
ingredients_df = ingredients_df.withColumn("ingredients_clean", regexp_replace(col("ingredients"), "[,,、;;]", ","))
ingredients_split = ingredients_df.withColumn("ingredient_list", split(col("ingredients_clean"), ","))
ingredients_exploded = ingredients_split.select("product_id", "brand", "price", explode("ingredient_list").alias("ingredient"))
ingredients_exploded = ingredients_exploded.withColumn("ingredient", regexp_replace(col("ingredient"), "^\\s+|\\s+$", ""))
ingredients_exploded = ingredients_exploded.filter((col("ingredient") != "") & (col("ingredient").isNotNull()))
ingredient_counts = ingredients_exploded.groupBy("ingredient").agg(count("product_id").alias("usage_count"), count("brand").alias("brand_count"))
ingredient_price_stats = ingredients_exploded.groupBy("ingredient").agg(avg("price").alias("avg_price"))
ingredient_analysis = ingredient_counts.join(ingredient_price_stats, "ingredient")
top_ingredients = ingredient_analysis.orderBy(desc("usage_count")).limit(30)
total_products = ingredients_df.count()
ingredient_results = []
for row in top_ingredients.collect():
ingredient_name = row["ingredient"]
usage_count = row["usage_count"]
brand_count = row["brand_count"]
avg_price = round(row["avg_price"], 2) if row["avg_price"] else 0
popularity_rate = round((usage_count / total_products) * 100, 2)
ingredient_results.append({"ingredient": ingredient_name, "usage_count": usage_count, "brand_count": brand_count, "avg_price": avg_price, "popularity_rate": popularity_rate})
popular_ingredients_result = {"top_ingredients": ingredient_results, "total_analyzed_products": total_products, "analysis_timestamp": pd.Timestamp.now().strftime("%Y-%m-%d %H:%M:%S")}
return popular_ingredients_result
基于大数据的化妆品数据可视化分析系统文档展示
💖💖作者:计算机编程小咖 💙💙个人简介:曾长期从事计算机专业培训教学,本人也热爱上课教学,语言擅长Java、微信小程序、Python、Golang、安卓Android等,开发项目包括大数据、深度学习、网站、小程序、安卓、算法。平常会做一些项目定制化开发、代码讲解、答辩教学、文档编写、也懂一些降重方面的技巧。平常喜欢分享一些自己开发中遇到的问题的解决办法,也喜欢交流技术,大家有技术代码这一块的问题可以问我! 💛💛想说的话:感谢大家的关注与支持! 💜💜 网站实战项目 安卓/小程序实战项目 大数据实战项目 深度学习实战项目