Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# find the leading batsman
team_df['lead'] = np.where(team_df['r1'] >= team_df['r2'], team_df['p1'], team_df['p2'])
team_df['follower'] = np.where(team_df['lead'] == team_df['p1'], team_df['p2'], team_df['p1'])
team_df['larger_score'] = np.where(team_df['r1'] >= team_df['r2'], team_df['r1'], team_df['r2'])
team_df['total_score'] = team_df['r1'] + team_df['r2']
# performance ratio
team_df['performance'] = team_df['larger_score']/(team_df['total_score']+0.01)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment