我需要让这个代码通过矢量化快速运行
final1 = pd.DataFrame()
for index, row in demo1.iterrows():
a = np.random.choice([0, 1], size=1000, p=[1 - row['prob'], row['prob']])
b = a * row['syb'] * (1 + row['percentage_change_syb'] / 100)
final1 = final1.append(pd.DataFrame(b).T)
Tags:
由于您没有提供要处理的数据,因此将取消选中以下代码,但它应该可以工作:
有关在NumPy数组上操作的更多信息,我建议使用this article。你知道吗
相关问题 更多 >
编程相关推荐