Monte Carlo后处理无法运行,NBA DFS阵容输出空白求助
NBA DFS蒙特卡洛模拟后处理代码问题
我写了一套用于NBA每日梦幻体育(DFS)阵容优化的蒙特卡洛模拟后处理代码,运行时没有报错,但最终输出的CSV阵容是空的。这套代码本应完成模拟数据清理、特征计算并生成最优阵容,而且进度提示也完全没触发。我可以提供完整代码协助排查问题,代码如下:
# simR may need to be deleted #need to convert this into a function simR = pd.DataFrame() # l is a dataFrame that will hold the total points scored by each lineup l = pd.DataFrame() ## a - m stores diffrent features of the simulation results a = [] b = [] c = [] d = [] e = [] f = [] g = [] h = [] k = [] m = [] token = True #GPP or cash for i in range(len(sim)): if token == True: p = sim.iloc[i,:][sim.iloc[i,:]<= round(num_l*0.01)] #top 1% 12 q = sim.iloc[i,:][sim.iloc[i,:]<=round(num_l*0.1)] #top 10% 117 r = sim.iloc[i,:][sim.iloc[i,:]>round(num_l*0.1)] #remaining 117 l = val.iloc[i,:] a.append(i+1) b.append(p.count()) e.append((p.count()/num_sim)*100) c.append(q.count()) f.append((q.count()/num_sim)*100) d.append(r.count()) h.append((r.count()/num_sim)*100) g.append((p.count()*4)+(q.count()*.1)-(r.count()*5)) k.append(l.mean()) m.append(l.std()) else: p = [sim.iloc[i,:][sim.iloc[i,:]<=600]] #top 50% r = [sim.iloc[i,:][sim.iloc[i,:]>600]] #bottom 50% l = val.iloc[i,:] a.append(i+1) b.append(p.count()) e.append((p.count()/num_sim)*100) d.append(r.count()) h.append((r.count()/num_sim)*100) g.append((p.count()*5)-(r.count()*5)) k.append(l.mean()) m.append(l.std()) if i == 1: print('Cleaning Data') elif i==round(num_l*.1): print('Data is 10% clean') elif i==round(num_l*.25): print('Data is 25% clean') elif i== round(num_l*.5): print('Data is 50% clean') elif i== round(num_l*.75): print('Data is 75% clean') elif i== (num_l-1): print('Data is 100% clean')
内容的提问来源于stack exchange,提问作者Eddie Chinea
相关产品推荐
相关产品推荐

