def get_wildcards(df_sim, df_div_winners, n_wc):
  """Calculate wildcards per simulation

  :param df_sim: simulated data
  :param df_div_winners: data frame with div winners in each iteration
  :param n_wc: number of wildcard positions open
  :return: data frame with wildcard teams per iteration
  """
  return (
    df_sim
    .merge(df_div_winners[['team_id', 'iteration']], on=['team_id', 'iteration'], how='left', indicator=True)
    .query('_merge=="left_only"')
    .drop('_merge', 1)
    .sort_values(by=['tot_wins', 'tot_pts'], ascending=[False, False])
    .groupby('iteration')
    .head(n_wc)
    .sort_values(by='iteration')
    .reset_index(drop=True)
  )