对全球电子游戏销售数据进行可视化展示,并使用支持向量回归进行预测分析
数据可视化部分
In [1]:
import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as snsIn [20]:
df = pd.read_csv("/home/mw/input/games6014/games_utf8.csv")In [9]:
df.head(5)Out[9]:
index Name Platform Year_of_Release Genre Publisher NA_Sales EU_Sales JP_Sales Other_Sales Global_Sales Critic_Score Critic_Count User_Score User_Count Developer Rating 0 0 Wii Sports Wii 2006 Sports Nintendo 41.36 28.96 3.77 8.45 82.53 76.0 51.0 8 322.0 Nintendo E 1 1 Super Mario Bros. NES 1985 Platform Nintendo 29.08 3.58 6.81 0.77 40.24 NaN NaN NaN NaN NaN NaN 2 2 Mario Kart Wii Wii 2008 Racing Nintendo 15.68 12.76 3.79 3.29 35.52 82.0 73.0 8.3 709.0 Nintendo E 3 3 Wii Sports Resort Wii 2009 Sports Nintendo 15.61 10.93 3.28 2.95 32.77 80.0 73.0 8 192.0 Nintendo E 4 4 Pokemon Red/Pokemon Blue GB 1996 Role-Playing Nintendo 11.27 8.89 10.22 1.00 31.37 NaN NaN NaN NaN NaN NaN In [10]:
df.info()<class 'pandas.core.frame.DataFrame'> RangeIndex: 16928 entries, 0 to 16927 Data columns (total 17 columns): index 16928 non-null int64 Name 16926 non-null object Platform 16928 non-null object Year_of_Release 16655 non-null object Genre 16926 non-null object Publisher 16873 non-null object NA_Sales 16928 non-null float64 EU_Sales 16928 non-null float64 JP_Sales 16928 non-null float64 Other_Sales 16928 non-null float64 Global_Sales 16926 non-null float64 Critic_Score 8260 non-null float64 Critic_Count 8260 non-null float64 User_Score 10159 non-null object User_Count 7718 non-null float64 Developer 10240 non-null object Rating 10092 non-null object dtypes: float64(8), int64(1), object(8) memory usage: 2.2+ MB查看各个字段不同数量
可以看到有
有16928条销售信息
有11562个不同的游戏
有33个不同的游戏平台In [11]:
df.nunique()Out[11]:
index 16928 Name 11562 Platform 33 Year_of_Release 40 Genre 14 Publisher 582 NA_Sales 402 EU_Sales 307 JP_Sales 244 Other_Sales 155 Global_Sales 629 Critic_Score 82 Critic_Count 106 User_Score 96 User_Count 888 Developer 1696 Rating 8 dtype: int64最畅销的游戏
在将不同平台上的相同游戏分组后,以下是前 5 名最畅销的游戏及其以百万计的销售数量。
In [13]:
df.groupby('Name')['Global_Sales'].sum().sort_values(ascending=False).head()Out[13]:
Name Wii Sports 82.53 Grand Theft Auto V
电子游戏销售数据可视化分析及预测
最新推荐文章于 2025-03-21 08:45:44 发布