數(shù)據(jù)來源:游戲玩家付費金額預(yù)測大賽
數(shù)據(jù)包含近229萬條記錄察净,109個字段掠手,以下取較重要的字段進(jìn)行說明抒巢。
字段說明:user_id:用戶編碼胎撇,用戶唯一標(biāo)識
? ? ? ? ? ? ? ? ? ?bd_stronghold_level:要塞等級介粘,相當(dāng)于游戲賬號等級
? ? ? ? ? ? ? ? ? ?wood_reduce_value:木頭消耗數(shù)量
? ? ? ? ? ? ? ? ? ? stone_reduce_value:石頭消耗數(shù)量
? ? ? ? ? ? ? ? ? ? ivory_reduce_value:象牙消耗數(shù)量
? ? ? ? ? ? ? ? ? ? meat_reduce_value:肉消耗數(shù)量
? ? ? ? ? ? ? ? ? ? magic_reduce_value:魔法消耗數(shù)量
? ? ? ? ? ? ? ? ? ? general_acceleration_reduce_value:通用加速消耗數(shù)量
? ? ? ? ? ? ? ? ? ? building_acceleration_reduce_value:建筑加速消耗數(shù)量
? ? ? ? ? ? ? ? ? ? reaserch_acceleration_reduce_value:科研加速消耗數(shù)量
? ? ? ? ? ? ? ? ? ? training_acceleration_reduce_value:訓(xùn)練加速消耗數(shù)量
? ? ? ? ? ? ? ? ? ? treatment_acceleration_reduce_value:治療加速消耗數(shù)量
? ? ? ? ? ? ? ? ? ? pvp_battle_count:玩家對玩家次數(shù)
? ? ? ? ? ? ? ? ? ? pve_battle_count:玩家對機器次數(shù)
? ? ? ? ? ? ? ? ? ? avg_online_minutes:日均在線時間
? ? ? ? ? ? ? ? ? ? pay_price: 消費金額
? ? ? ? ? ? ? ? ? ? pay_count:消費次數(shù)
分析思路:用戶注冊時間分布情況?
? ? ? ? ? ? ? ? ? ? 用戶的付費情況(付費率晚树,ARPU姻采,ARPPU)?
? ? ? ? ? ? ? ? ? ? 各等級用戶的付費情況爵憎?
? ? ? ? ? ? ? ? ? ? 用戶的消費習(xí)慣慨亲?
? ? ? ? ? ? ? ? ? ? 可視化數(shù)據(jù)
分析過程:
①導(dǎo)入數(shù)據(jù)
import numpy as np
import pandas as pd
from pandas import read_csv
from sklearn.cluster import KMeans
import matplotlib.pyplotas plt
import pylab as pl
from matplotlib.font_managerimport FontManager, FontProperties
pd.set_option('display.max_columns',None)
#為了數(shù)據(jù)安全,copy一份數(shù)據(jù)
df=df0
#檢查是否有空值
print(df.isnull().any().any())
#觀察數(shù)據(jù)構(gòu)成
print(df.head())
②清洗數(shù)據(jù)
#以user_id為維度宝鼓,刪除重復(fù)數(shù)據(jù)巡雨,并查看用戶總數(shù)
df=df.drop_duplicates(subset='user_id')
print('用戶總數(shù):',len(df['user_id']))
→用戶總數(shù):2288007
③計算用戶注冊時間分布
#首先將注冊時間精確到天
register_date=[]
for i in df['register_time']:
????date=i[5:10]
????register_date.append(date)
df['register_time']=register_date
#計算每天的注冊人數(shù)
df_register=df.groupby('register_time').size()
df_register.columns=['日期','注冊人數(shù)']
print(df_register)
(可視化)
plt.plot(df_register)
plt.grid(True)
pl.xticks(rotation=90)
font=FontProperties(fname='/System/Library/Fonts/PingFang.ttc')
plt.title('用戶注冊分布圖',fontproperties=font)
plt.show()
△可以看出,用戶注冊數(shù)在2月19日有一次的大的高峰席函,其他時間也分別有幾次小高峰,且高峰的持續(xù)時間很短冈涧,可以推測是因為游戲推出一些獎勵活動或公司對游戲的推廣取得了效果進(jìn)而使注冊用戶激增茂附。
④用戶的付費情況(付費率,ARPU督弓,ARPPU)
#付費率(付費人數(shù)/活躍人數(shù))
df_pay_user=df[(df['pay_price']>0)]
pay_rate=df_pay_user['user_id'].count()/df_active_user['user_id'].count()
print('付費率:%.2f'%(pay_rate))
#ARPU(總付費金額/活躍人數(shù))
arpu=df_pay_user['pay_price'].sum()/df_active_user['user_id'].count()
print('ARPU:%.2f'%(arpu))
#ARPPU(總付費金額/付費人數(shù))
arppu=df_pay_user['pay_price'].sum()/df_pay_user['user_id'].count()
print('ARPPU:%.2f'%(arppu))
△目前盈利較好的手游的ARPU超過5元营曼,一般手游在3~5元之間,盈利較差的低于3元愚隧,該游戲的ARPU為8.55元蒂阱,說明盈利水平較高。
⑤不同等級用戶的付費情況
df_user=df[['user_id','bd_stronghold_level','pay_price','pay_count']]
df_table=pd.pivot_table(df_user,index=['bd_stronghold_level'],
values=['user_id','pay_price','pay_count'],
aggfunc={'user_id':'count','pay_price':'sum','pay_count':'sum'})
df_stronghold_pay=pd.DataFrame(df_table.to_records())
#各等級付費人數(shù)
df_stronghold_pay['pay_num']=df_user[(df_user['pay_price']>0)].groupby('bd_stronghold_level').user_id.count()
#各等級付費轉(zhuǎn)化率
df_stronghold_pay['pay_rate']=df_stronghold_pay['pay_num']/df_stronghold_pay['user_id']
#各等級平均付費金額
df_stronghold_pay['avg_pay_price']=df_stronghold_pay['pay_price']/df_stronghold_pay['user_id']
#各等級平均付費次數(shù)
df_stronghold_pay['avg_pay_count']=df_stronghold_pay['pay_count']/df_stronghold_pay['user_id']
#重命名列名
df_stronghold_pay.columns=['要塞等級','總付費次數(shù)','總付費金額','總?cè)藬?shù)',
'付費人數(shù)','付費轉(zhuǎn)化率','人均付費金額','人均付費次數(shù)']
df_stronghold_pay=df_stronghold_pay[['要塞等級','總?cè)藬?shù)','付費人數(shù)','付費轉(zhuǎn)化率',
'總付費金額','人均付費金額','總付費次數(shù)','人均付費次數(shù)']]
df_stronghold_pay=df_stronghold_pay.round(2)
print(df_stronghold_pay)
(可視化)
#要塞等級—付費轉(zhuǎn)化率
x=df_stronghold_pay['要塞等級']
y=df_stronghold_pay['付費轉(zhuǎn)化率']
plt.xticks(x,range(0,len(x),1))
plt.plot(x,y)
plt.grid(True)
plt.title('不同等級用戶付費轉(zhuǎn)化率',fontproperties=font)
plt.show()
#要塞等級-人均付費金額
x=df_stronghold_pay['要塞等級']
y=df_stronghold_pay['人均付費金額']
plt.xticks(x,range(0,len(x),1))
plt.plot(x,y)
plt.grid(True)
plt.title('不同等級用戶人均付費jine',fontproperties=font)
plt.show()
x=df_stronghold_pay['要塞等級']
y=df_stronghold_pay['人均付費金額']
plt.xticks(x,range(0,len(x),1))
plt.plot(x,y)
plt.grid(True)
plt.title('不同等級用戶人均付費jine',fontproperties=font)
plt.show()
#要塞等級-人均付費次數(shù)
x=df_stronghold_pay['要塞等級']
y=df_stronghold_pay['人均付費次數(shù)']
plt.xticks(x,range(0,len(x),1))
plt.plot(x,y)
plt.grid(True)
plt.title('不同等級用戶人均付費次數(shù)',fontproperties=font)
plt.show()
△用戶等級到達(dá)10級時狂塘,付費率接近60%录煤,等級到達(dá)13級時,付費率接近100%荞胡,且人均付費金額和次數(shù)兩項指標(biāo)也在用戶達(dá)到10級后增長迅速妈踊,因此可以認(rèn)定10級以上用戶為游戲的核心用戶。
△但是觀察用戶等級分布泪漂,發(fā)現(xiàn)絕大部分用戶還是處在10級以下的水平廊营,因此如何使用戶達(dá)到10級是游戲運營接下來需要考慮的事歪泳。
⑥不同玩家的消費習(xí)慣
該游戲充值主要可以獲得道具類(木頭、石頭露筒、象牙呐伞、肉、魔法)和加速券類(通用慎式、建筑伶氢、科研、訓(xùn)練瞬捕、醫(yī)療)鞍历。根據(jù)用戶的充值金額大小,分別分析兩類消費品的消耗情況肪虎。
#將等級>=10級的玩家劃分為:消費>=500為高消費玩家劣砍,<500為普通玩家
df_eli_user=df[(df['pay_price']>=500)&(df['bd_stronghold_level']>=10)]
df_nor_user=df[(df['pay_price']<500)&(df['bd_stronghold_level']>10)]
#不同玩家的道具消耗情況
wood_avg=[df_eli_user['wood_reduce_value'].mean(),df_nor_user['wood_reduce_value'].mean()]
stone_avg=[df_eli_user['stone_reduce_value'].mean(),df_nor_user['stone_reduce_value'].mean()]
ivory_avg=[df_eli_user['ivory_reduce_value'].mean(),df_nor_user['ivory_reduce_value'].mean()]
meat_avg=[df_eli_user['meat_reduce_value'].mean(),df_nor_user['meat_reduce_value'].mean()]
magic_avg=[df_eli_user['magic_reduce_value'].mean(),df_nor_user['magic_reduce_value'].mean()]
props_data={'high_value_player':[wood_avg[0],stone_avg[0],ivory_avg[0],meat_avg[0],magic_avg[0]],
? ? ? ? ? ????????????? 'normal_player':[wood_avg[1],stone_avg[1],ivory_avg[1],meat_avg[1],magic_avg[1]]}
df_props=pd.DataFrame(props_data,index=['wood','stone','ivory','meat','magic'])
df_props=df_props.round(2)
print(df_props)
#可視化
ax=df_props.plot(kind='bar',title='Props Reduce',
? ? ? ? ? ? ? ? grid=True,legend=True)
plt.show()
△普通玩家和高消費玩家對木頭、石頭扇救、肉的消耗都較大刑枝,魔法的消耗都較小,而在象牙的消耗上迅腔,高消費玩家和普通玩家的消耗差距較大装畅。
#不同玩家的加速券消耗情況
general_avg=[df_eli_user['general_acceleration_reduce_value'].mean(),
? ? ? ? ? ? df_nor_user['general_acceleration_reduce_value'].mean()]
building_avg=[df_eli_user['building_acceleration_reduce_value'].mean(),
? ? ? ? ? ? ? df_nor_user['building_acceleration_reduce_value'].mean()]
research_avg=[df_eli_user['reaserch_acceleration_reduce_value'].mean(),
? ? ? ? ? ? ? df_nor_user['reaserch_acceleration_reduce_value'].mean()]
training_avg=[df_eli_user['training_acceleration_reduce_value'].mean(),
? ? ? ? ? ? ? df_nor_user['training_acceleration_reduce_value'].mean()]
treatment_avg=[df_eli_user['treatment_acceleration_reduce_value'].mean(),
? ? ? ? ? ? ? df_nor_user['treatment_acceleration_reduce_value'].mean()]
acceleration_data={'high_value_player':[general_avg[0],building_avg[0],research_avg[0],
? ? ? ? ? ? ? ? ? ? ? ? ? training_avg[0],treatment_avg[0]],
? ? ? ? ? ? ? ? ? 'normal_player':[general_avg[1],building_avg[1],research_avg[1],
? ? ? ? ? ? ? ? ? ? ? ? ? training_avg[1],treatment_avg[1]]}
df_acceleration=pd.DataFrame(acceleration_data,index=['general','building','researching','training','treatment'])
print(df_acceleration.round(2))
#可視化
ax=df_acceleration.plot(kind='bar',title='Acceleration Reduce',
? ? ? ? ? ? ? ? grid=True,legend=True)
plt.show()
△兩類玩家對對治療加速券消耗都很小,對通用加速券的消耗差異較大沧烈,其他三種加速券消耗差別不大掠兄。
結(jié)論:1.該游戲具有較大的用戶基數(shù),且新用戶注冊受游戲活動锌雀、新版本等因素影響較大蚂夕。
? ? ? ? ? ? ?2.該游戲的ARPU為8.55,說明該游戲的盈利能力較高腋逆。
? ? ? ? ? ? ?3.用戶等級達(dá)到10級后婿牍,付費意愿明顯上升,且達(dá)到13級時付費率將近100%惩歉。但是絕大多數(shù)用戶仍然停留在10級以下等脂,如何使用戶平滑升至10級尤為重要。
? ? ? ? ? ? ?4.消費習(xí)慣上撑蚌,高消費玩家對象牙和通用加速券的需求遠(yuǎn)多于一般玩家上遥。