Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def simulate_election(model, nsim):
- sim = np.random.uniform(size =(51, nsim))
- greter = (sim < model.Obama.reshape(-1,1)).astype(float) * model.Votes.reshape(-1,1)
- return greter.sum(axis =0)
- result = simulate_election(predictwise, 10000)
- print result
- output : array([ 314., 303., 313., ..., 316., 302., 284.])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement