主机游戏销售数据分析练习
主機游戲銷售數(shù)據(jù)分析練習(xí)
- 數(shù)據(jù)讀取與預(yù)處理
- 發(fā)行商角度
- 排名前10各發(fā)行商發(fā)布游戲占比
- 最受歡迎游戲發(fā)行商排名
- 排名前10發(fā)行商發(fā)行游戲時間活躍度
- 游戲角度
- 各類型游戲占比
- 地區(qū)角度
- 各類型游戲于各地區(qū)受歡迎程度
- 平臺角度
- 排名前10各平臺游戲發(fā)行量 & 銷售額(市場份額)
- 時間角度
- 各年份游戲銷量 & 各年份游戲發(fā)行量
- 每年各地區(qū)游戲銷量
這份數(shù)據(jù)集是一張包含銷量超過10萬份的電視游戲清單,數(shù)據(jù)來自vgcharts.com
指標(biāo)分析流程:
數(shù)據(jù)讀取與預(yù)處理
import numpy as np import pandas as pd ? df = pd.read_csv(r'C:/Users/Administrator/Desktop/vgsales.csv') df.head(10)
字段名解釋:
Rank:排名
Name:游戲名
Platform:游戲發(fā)行平臺
Year:發(fā)布時間
Genre:游戲類別
Publisher:發(fā)行商
NA_Sales:北美區(qū)銷量(百萬)
EU_Sales:歐洲區(qū)銷量(百萬)
JP_Sales:日本區(qū)銷量(百萬)
Other_Sales:其他區(qū)銷量(百萬)
Global_Sales:全球總銷量(百萬)
df.info() # 缺失值處理 df.isnull().sum(axis = 0)
數(shù)據(jù)缺失值不多,直接刪除缺失值所在行
發(fā)行商角度
排名前10各發(fā)行商發(fā)布游戲占比
df_publisher = df.pivot_table(index = 'Publisher',values = 'Name',aggfunc = {'Name':'count'}) df_publisher.rename(columns = {'Name':'amount'}, inplace = True) top10_publisher = df_publisher.sort_values(by = 'amount', ascending = False)[:10] top10_publisher # 排名前10發(fā)行商 other_publisher_amount = df_publisher['amount'].count() - top10_publisher['amount'].count() top10_publisher.reset_index(inplace = True) top10_publisher # 排名10以外的發(fā)行商 others_amount = {'Publisher':'others', 'amount':[other_publisher_amount]} others = pd.DataFrame(others_amount) others
top10_others = pd.DataFrame(columns = [‘Publisher’,‘a(chǎn)mount’], index = [‘0’,‘1’])
top10_others.iloc[0,0] = ‘top10’
top10_others.iloc[0,1] = top10_publisher[‘a(chǎn)mount’].sum()
top10_others.iloc[1,:] = others.iloc[0,:]
top10_others
繪制餅圖,查看各發(fā)行商發(fā)行游戲數(shù)量占比
最受歡迎游戲發(fā)行商排名
most_popular_publisher = df.pivot_table(index = 'Publisher',values = 'Global_Sales',aggfunc = {'Global_Sales':'sum'}) most_popular_publisher.sort_values(by ='Global_Sales', ascending = False, inplace = True) most_popular_publisher # 最受歡迎排名前十 top10_popular = most_popular_publisher.iloc[:10,:] top10_popular.reset_index(inplace = True) others_sales = df['Global_Sales'].sum() - top10_popular['Global_Sales'].sum() others_pop = {'Publisher':'others','Global_Sales':[others_sales]} others_df_pop = pd.DataFrame(others_pop) others_df_pop top10_others_pop = pd.DataFrame(columns = ['Publisher','Global_Sales'],index = ['0','1']) top10_others_pop.iloc[0,0] = 'top10' top10_others_pop.iloc[0,1] = top10_popular['Global_Sales'].sum() top10_others_pop.iloc[1,:] = others_df_pop.iloc[0,:] top10_others_pop fig2 = plt.figure(figsize = (15,15)) ax3 = fig2.add_subplot(1,2,1) plt.pie(top10_others_pop['Global_Sales'], labels = top10_others_pop['Publisher'], autopct = '%1.2ff%%') plt.title('最受歡迎top10的發(fā)行商所占市場份額圖') ax4 = fig2.add_subplot(1,2,2) plt.pie(top10_popular['Global_Sales'], labels = top10_popular['Publisher'], autopct = '%1.2ff%%') plt.title('最受歡迎top10份額占比圖') top10_ = pd.merge(top10_popular, top10_publisher,how = 'outer') top10_['Sales_Amount_Rate'] = top10_['Global_Sales'] / top10_['amount'] top10_
經(jīng)過兩表外連接后,不難看出:
- 游戲發(fā)行量top10與最受歡迎(銷量高)發(fā)行商top10被相同十家巨頭占據(jù)
- 由Sales_Amount_Rate指標(biāo)可知,任天堂雖然發(fā)行游戲數(shù)在top10中較為中庸,在全球范圍內(nèi)仍是最受歡迎的游戲發(fā)行商
排名前10發(fā)行商發(fā)行游戲時間活躍度
publisher_time_active = df.pivot_table(index = ['Publisher', 'Year'],values = 'Name',aggfunc = {'Name':'count'}) publisher_time_active.rename(columns = {'Name':'Amount'}, inplace = True) pta = publisher_time_active.reset_index() pta # 列出最具競爭力的十家發(fā)行商 tmp10 = top10_publisher['Publisher'].values tmp10 frame1 = pta.loc[pta['Publisher'] == 'Electronic Arts', :] frame1.set_index('Year', inplace = True) frame2 = pta.loc[pta['Publisher'] == 'Activision', :] frame2.set_index('Year', inplace = True) frame3 = pta.loc[pta['Publisher'] == 'Namco Bandai Games', :] frame3.set_index('Year', inplace = True) frame4 = pta.loc[pta['Publisher'] == 'Ubisoft', :] frame4.set_index('Year', inplace = True) frame5 = pta.loc[pta['Publisher'] == 'Konami Digital Entertainment', :] frame5.set_index('Year', inplace = True) frame6 = pta.loc[pta['Publisher'] == 'THQ', :] frame6.set_index('Year', inplace = True) frame7 = pta.loc[pta['Publisher'] == 'Nintendo', :] frame7.set_index('Year', inplace = True) frame8 = pta.loc[pta['Publisher'] == 'Sony Computer Entertainment', :] frame8.set_index('Year', inplace = True) frame9 = pta.loc[pta['Publisher'] == 'Sega', :] frame9.set_index('Year', inplace = True) frame10 = pta.loc[pta['Publisher'] == 'Take-Two Interactive', :] frame10.set_index('Year', inplace = True) frame1.plot() plt.title('Electronic Arts發(fā)行游戲時間活躍度') plt.axis([1980,2021,0,121]) # plt.xticks(range(1980, 2021,5)) # plt.yticks(range(0, 121, 20)) frame2.plot() plt.title('Activision發(fā)行游戲時間活躍度') plt.xticks(range(1980, 2021,5)) plt.yticks(range(0, 121, 20)) frame3.plot() plt.title('Namco Bandai Games發(fā)行游戲時間活躍度') plt.xticks(range(1980, 2021,5)) plt.yticks(range(0, 121, 20)) frame4.plot() plt.title('Ubisoft發(fā)行游戲時間活躍度') plt.xticks(range(1980, 2021,5)) plt.yticks(range(0, 121, 20)) frame5.plot() plt.title('Konami Digital Entertainment發(fā)行游戲時間活躍度') plt.xticks(range(1980, 2021,5)) plt.yticks(range(0, 121, 20)) frame6.plot() plt.title('THQ發(fā)行游戲時間活躍度') plt.xticks(range(1980, 2021,5)) plt.yticks(range(0, 121, 20)) frame7.plot() plt.title('Nintendo發(fā)行游戲時間活躍度') plt.xticks(range(1980, 2021,5)) plt.yticks(range(0, 121, 20)) frame8.plot() plt.title('Sony Computer Entertainment發(fā)行游戲時間活躍度') plt.xticks(range(1980, 2021,5)) plt.yticks(range(0, 121, 20)) frame9.plot() plt.title('Sega發(fā)行游戲時間活躍度') plt.xticks(range(1980, 2021,5)) plt.yticks(range(0, 121, 20)) frame10.plot() plt.title('Take-Two Interactive發(fā)行游戲時間活躍度') plt.xticks(range(1980, 2021,5)) plt.yticks(range(0, 121, 20))
從上圖可知,排名前十的游戲發(fā)行商都是從上世紀(jì)就開始發(fā)行游戲的老牌發(fā)行商
從上世紀(jì)九十年代末到2015年的二十年左右時間里大部分發(fā)行商發(fā)行游戲數(shù)量出現(xiàn)鐘形走勢,可能在這段時間里用戶對電視游戲的需求也開始增長并逐漸趨于飽和
游戲角度
各類型游戲占比
genre_of_game = df.pivot_table(index = 'Genre',values = ['Name', 'Global_Sales'],aggfunc = {'Name':'count','Global_Sales':'sum'}) genre_of_game.rename(columns = {'Name':'Amount'}, inplace = True) genre_of_game.sort_values(by = ['Global_Sales','Amount'], ascending = False) genre_of_game.plot()
如圖可知,游戲類型數(shù)量與受歡迎程度呈現(xiàn)一定正相關(guān)性
賣的最好的動作類游戲與運動類游戲同時也是游戲數(shù)量最多的兩類
平臺游戲的銷售量與數(shù)量十分接近,可以看出發(fā)行的單位游戲數(shù)量的類型中平臺游戲的銷售量會是最高的
地區(qū)角度
各類型游戲于各地區(qū)受歡迎程度
genre_area = df.pivot_table(index = 'Genre',values = ['NA_Sales','EU_Sales','JP_Sales','Other_Sales'],aggfunc = {'NA_Sales':'sum','EU_Sales':'sum','JP_Sales':'sum','Other_Sales':'sum'}) genre_area genre_area.reset_index(inplace = True) genre_area add_up = {'Genre':'add_up','EU':[genre_area['EU_Sales'].sum()],'JP':[genre_area['JP_Sales'].sum()],'NA':[genre_area['NA_Sales'].sum()],'Other':[genre_area['Other_Sales'].sum()]} add_up_df = pd.DataFrame(add_up) add_up_df # 歸一化 for i in range(0,len(genre_area.iloc[:,0])):for j in range(1,len(genre_area.iloc[0,:])):genre_area.iloc[i, j] = genre_area.iloc[i, j] / add_up_df.iloc[0, j] genre_area genre_area.set_index('Genre').T.plot.barh(figsize = (12,4), stacked = True)- 歐洲區(qū)玩家最喜歡格斗、運動、射擊類游戲,而對策略類游戲等興趣較低,其他區(qū)域玩家與歐洲區(qū)偏好相仿
- 北美區(qū)玩家與歐洲區(qū)喜好相仿,由于歐美文化也經(jīng)常會放在一起討論,個人認為所以游戲也可以理解為與文化差異息息相關(guān)
- 日本區(qū)玩家對角色扮演游戲熱愛程度最高,甚至拉出第二動作類游戲兩倍之多,考慮到現(xiàn)實中日本的二次元、jk文化盛行,也許與此有關(guān)
平臺角度
排名前10各平臺游戲發(fā)行量 & 銷售額(市場份額)
platform_df = df.pivot_table(index = 'Platform',values = ['Name','Global_Sales'],aggfunc = {'Name':'count','Global_Sales':'sum'}) platform_df.sort_values(by = ['Name','Global_Sales'], inplace = True, ascending = False) platform_df top10_platform = platform_df.iloc[:10,:] top10_platform
排名前10的平臺有任天堂的NDS、Wii、GBA,索尼的PS、PS2、PS3、PSP,微軟的XB、X360和PC
由此可見主機游戲市場早已是三分天下
top10_platform.plot.bar() plt.xticks(rotation = 45) plt.title('排名前十各平臺游戲發(fā)行量與銷售額柱狀圖')
排名前10各平臺中NDS和PS2的游戲發(fā)行數(shù)量遙遙領(lǐng)先,NDS、PS2、PS3、Wii、X360、PS這幾個平臺的市場份額并列最高,基本持平
時間角度
各年份游戲銷量 & 各年份游戲發(fā)行量
year_sales = df.pivot_table(index = 'Year',values = ['Global_Sales', 'Name'],aggfunc = {'Global_Sales':'sum','Name':'count'}) year_sales year_sales.plot(marker = '*') plt.title('各年份游戲銷量圖')
由上圖可知,從1980年代開始主機游戲銷量震蕩緩慢上漲,并在二十世紀(jì)初出現(xiàn)井噴式增長,最后在2010年左右劇烈下滑
初步分析與猜測:若不考慮數(shù)據(jù)源問題,2010年左右游戲市場趨于飽和,沒有足夠多有吸引力的新游戲上市,導(dǎo)致行業(yè)發(fā)展進入瓶頸期
每年各地區(qū)游戲銷量
year_area_sales = df.pivot_table(index = 'Year',values = ['EU_Sales','JP_Sales','NA_Sales'],aggfunc = {'EU_Sales':'sum','JP_Sales':'sum','NA_Sales':'sum'}) year_area_sales year_area_sales.plot(marker = '*') plt.title('每年各地區(qū)的游戲銷量折線圖')由上圖可知,在主機游戲市場,北美區(qū)的銷量基本上處于領(lǐng)先地位,日本區(qū)可能由于人口基數(shù)小的原因?qū)е落N量即使在2005-2010年的全球高速增長時期也表現(xiàn)一般
總結(jié):
- 從各類指標(biāo)top10中可知,動作類型的游戲普遍受眾度更高
- 策略、解謎類型游戲的玩者較少
- 個人認為游戲?qū)儆诘谌a(chǎn)業(yè),數(shù)據(jù)中表現(xiàn)的形式是經(jīng)濟發(fā)達地區(qū)與游戲的銷量等關(guān)系有直接關(guān)系
總結(jié)
以上是生活随笔為你收集整理的主机游戏销售数据分析练习的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 菜鸟+Sa+注入工具组合=肉鸡成群
- 下一篇: gpio_desc()的分析