With this DataFrame, how can I conditionally set rating to 0 when line_race is equal to zero?
rating
line_race
line_track line_race rating fo
Use numpy.where to say if ColumnA = x then ColumnB = y else ColumnB = ColumnB:
df['rating'] = np.where(df['line_race']==0, 0, df['rating'])