购买中国体育彩票时,通常会纠结于30还是31亦或是10,今天基于pandas统计一下足彩中凯利指数与比赛结果的特点,供大家参考:
凯利指数是按照一场赛事中对所有公司开出的赔率和胜负平概率通过凯利指数计算公式得到的。其计算方法为:用市场平均的概率乘以某一家公司的赔率指数,即为该公司各项指数的凯利指数,它反映了各项指数存在的市场赔付风险,即市场动态与事前确立的赔付率之间的赔付差异。
了解了什么是凯利指数后,我们应该了解一场比赛中,不同赔率的公司对应的凯利指数总是会不同的。而只有较大的公司如竞彩官方、香港马会、威廉希尔、立博等等才能做到其凯利指数趋同于赔付率。由于凯利指数反映了博彩公司数据的真实趋势和投注资金流量流向,在一场比赛中借助于各家凯利指数差异值和趋同点,我们通常能发现这场比赛结果的趋势。为此,接下来找出哪些公司的凯利指数最具有参考价值:
读取足彩大数据文件后,需要对各家公司的凯利指数形式进行分类别:
start_time = time.time() final_data['kelly']=1 final_data['kelly']=final_data['kelly'].mask((final_data['win_Kelly_index']>final_data['draw_Kelly_index']) & (final_data['draw_Kelly_index']>final_data['lost_Kelly_index']) ,321) final_data['kelly']=final_data['kelly'].mask((final_data['win_Kelly_index']>final_data['lost_Kelly_index']) & (final_data['draw_Kelly_index']final_data['lost_Kelly_index']) ,132) final_data['kelly']=final_data['kelly'].mask((final_data['win_Kelly_index']>final_data['draw_Kelly_index']) & (final_data['win_Kelly_index'] final_data['lost_Kelly_index']) ,231) final_data['kelly']=final_data['kelly'].mask((final_data['win_Kelly_index']==final_data['lost_Kelly_index']) & (final_data['draw_Kelly_index']>final_data['lost_Kelly_index']) ,131) final_data['kelly']=final_data['kelly'].mask((final_data['win_Kelly_index']==final_data['draw_Kelly_index']) & (final_data['draw_Kelly_index'] final_data['draw_Kelly_index']) & (final_data['draw_Kelly_index']==final_data['lost_Kelly_index']) ,311) final_data['kelly']=final_data['kelly'].mask((final_data['win_Kelly_index'] final_data['lost_Kelly_index']) ,331) final_data['kelly']=final_data['kelly'].mask((final_data['win_Kelly_index']==final_data['draw_Kelly_index']) & (final_data['draw_Kelly_index']==final_data['lost_Kelly_index']) ,111) print("总耗时:",time.time()-start_time) final_data
接下来,需要将不同都凯利指数形式与比赛结果连接起来:
df['sum_1']=0 df['sum_1']=df['sum_1'].mask((df['kelly']==321 ) & (df['result310']==0) ,1) df['sum_1']=df['sum_1'].mask((df['kelly']==123 ) & (df['result310']==3) ,1) df['sum_1']=df['sum_1'].mask((df['kelly']==131 ) & (df['result310']==0) ,1) df['sum_1']=df['sum_1'].mask((df['kelly']==131 ) & (df['result310']==3) ,1) df['sum_1']=df['sum_1'].mask((df['kelly']==213 ) & (df['result310']==1) ,1) df['sum_1']=df['sum_1'].mask((df['kelly']==132 ) & (df['result310']==3) ,1) df['sum_1']=df['sum_1'].mask((df['kelly']==133 ) & (df['result310']==3) ,1) df['sum_1']=df['sum_1'].mask((df['kelly']==311 ) & (df['result310']==0) ,1) df['sum_1']=df['sum_1'].mask((df['kelly']==311 ) & (df['result310']==1) ,1) df['sum_1']=df['sum_1'].mask((df['kelly']==313 ) & (df['result310']==1) ,1) df['sum_1']=df['sum_1'].mask((df['kelly']==113 ) & (df['result310']==1) ,1) df['sum_1']=df['sum_1'].mask((df['kelly']==113 ) & (df['result310']==3) ,1) df['sum_1']=df['sum_1'].mask((df['kelly']==231 ) & (df['result310']==0) ,1) df['sum_1']=df['sum_1'].mask((df['kelly']==312 ) & (df['result310']==1) ,1) df['sum_1']=df['sum_1'].mask((df['kelly']==331 ) & (df['result310']==0) ,1) df['sum_1']=df['sum_1'].mask((df['kelly']==111 ) & (df['result310']==0) ,1) df['sum_1']=df['sum_1'].mask((df['kelly']==111 ) & (df['result310']==1) ,1) df['sum_1']=df['sum_1'].mask((df['kelly']==111 ) & (df['result310']==3) ,1)
利用pandas对不同联赛杯赛下的各种凯利指数分布与比赛结果进行排序,整理如下:
#按照companyid计算有比赛的场次个数 df1 = df[df['last_asianodd']=='0.25'].groupby('companyid').agg({'fullscore':'count'}).reset_index() #按照companyid计算有比赛且符合第一二小的场次个数 df2 = df[df['last_asianodd']=='0.25'].loc[df['sum_1']==1].groupby('companyid').agg({'fullscore':'count'}).reset_index() df2.rename(columns={'fullscore':'score'}, inplace = True) df_new = pd.merge(df1,df2,on = 'companyid',how='left') df_new.eval("""percent = score / fullscore""", inplace=True) df_new = pd.merge(df_new,final_companyid,on = 'companyid',how='left') df_new.sort_values(by='percent',ascending = False, inplace=True) df_new.rename(columns={'fullscore':'场数','score':'出现次数','percent':'占比','companyname':'公司'}, inplace = True) df_new.drop('companyid_cn',axis=1).drop('companyid',axis=1).reset_index().drop('index',axis=1)
结果如下:
图1 欧冠0.25球中凯利指数第一小值打出概率排名(更新2021.11.03)
图2 欧冠0.25球凯利指数第一二小值打出概率排名(更新2021.11.03)
图3 西甲0.25球中凯利指数第一小值打出概率排名(更新2021.11.03)
图4 西甲0.25球凯利指数第一二小值打出概率排名(更新2021.11.03)
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)