电子游戏销售分析

Viveka ·
更新时间:2024-09-21
· 798 次阅读

Video Game Sales电子游戏销售分析 定义问题:

特征分析:

1.游戏平台分析 2.游戏类型分析 3.地区对比

预测分析:

未来的销售趋势预测 # 导包 import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns from pyecharts import options as opts from pyecharts.charts import Pie from pyecharts import options as opts from pyecharts.charts import Bar plt.style.use('seaborn') plt.rcParams['font.sans-serif']=['Simhei'] #显示中文,解决图中无法显示中文的问题 plt.rcParams['axes.unicode_minus']=False #设置显示中文后,负号显示受影响。解决坐标轴上乱码问题 数据清洗 # 导入数据 data = pd.read_csv("vgsales.csv") # 查看数据结构,发现Year,Publisher等项是有空值的 print("行数 : ", data.shape[0]) print("列数 : ", data.shape[1]) print("\n特征数量 : \n", data.columns.tolist()) print("\n缺失值 : \n", data.isnull().sum()) print("\n唯一值 : \n", data.nunique()) 行数 : 16598 列数 : 11 特征数量 : ['Rank', 'Name', 'Platform', 'Year', 'Genre', 'Publisher', 'NA_Sales', 'EU_Sales', 'JP_Sales', 'Other_Sales', 'Global_Sales'] 缺失值 : Rank 0 Name 0 Platform 0 Year 271 Genre 0 Publisher 58 NA_Sales 0 EU_Sales 0 JP_Sales 0 Other_Sales 0 Global_Sales 0 dtype: int64 唯一值 : Rank 16598 Name 11493 Platform 31 Year 39 Genre 12 Publisher 578 NA_Sales 409 EU_Sales 305 JP_Sales 244 Other_Sales 157 Global_Sales 623 dtype: int64 # 数据体量还是比较大的,这里就直接删除了空值 data.dropna(inplace=True) # 重置下索引 data.reset_index(drop=True,inplace=True) data.head()
Rank Name Platform Year Genre Publisher NA_Sales EU_Sales JP_Sales Other_Sales Global_Sales
0 1 Wii Sports Wii 2006.0 Sports Nintendo 41.49 29.02 3.77 8.46 82.74
1 2 Super Mario Bros. NES 1985.0 Platform Nintendo 29.08 3.58 6.81 0.77 40.24
2 3 Mario Kart Wii Wii 2008.0 Racing Nintendo 15.85 12.88 3.79 3.31 35.82
3 4 Wii Sports Resort Wii 2009.0 Sports Nintendo 15.75 11.01 3.28 2.96 33.00
4 5 Pokemon Red/Pokemon Blue GB 1996.0 Role-Playing Nintendo 11.27 8.89 10.22 1.00 31.37
特征分析 # 做一个平台和游戏类型的频次交叉表来看一下,平台的游戏类型分布情况 Plat_Genre = pd.crosstab(data.Platform,data.Genre) Plat_Genre_sum = Plat_Genre.sum(axis=1).sort_values(ascending = False) #平台的销量分布情况 Plat_Global_Sales = data.groupby('Platform')['Global_Sales'].sum().sort_values(ascending = False) #游戏类型销量分布情况 Genre_Global_Sales = data.groupby('Genre')['Global_Sales'].sum().sort_values(ascending = False) # 可视化 f,ax = plt.subplots(1,3,figsize=(25,8),dpi=100) sns.barplot(Plat_Genre_sum.values,Plat_Genre_sum.index,ax=ax[0]) ax[0].set_title('Platform_Genre') sns.barplot(Plat_Global_Sales.values,Plat_Global_Sales.index,ax=ax[1]) ax[1].set_title('Platform_Global_Sales') sns.barplot(Genre_Global_Sales.values,Genre_Global_Sales.index,ax=ax[2]) ax[2].set_title('Genre_Global_Sales') plt.show()

原创文章 11获赞 10访问量 4970 关注 私信 展开阅读全文
作者:WiFi下的365



销售分析 销售 电子

需要 登录 后方可回复, 如果你还没有账号请 注册新账号