Skip to content

Instantly share code, notes, and snippets.

@micahmelling
Created March 6, 2018 04:16
Show Gist options
  • Select an option

  • Save micahmelling/98377980eed59edad83840b998ee5c65 to your computer and use it in GitHub Desktop.

Select an option

Save micahmelling/98377980eed59edad83840b998ee5c65 to your computer and use it in GitHub Desktop.
last_row_df = at_bat_results.tail(1)
if last_row_df['swing'].any() == 'yes':
end_of_at_bat = np.random.choice(a=['yes', 'no'], p=[swing_produces_out, 1 - swing_produces_out])
else:
end_of_at_bat = 'no'
if at_bat_results['result'].any() == 'no_hit' and end_of_at_bat == 'no':
new_count = np.random.choice(a=['0-1', '1-0'], p=[0.50, 0.50])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment