Session Ready
Exercise

Settle a debate with .apply()

Word has gotten to the Arizona Diamondbacks about your awesome analytics skills. They'd like for you to help settle a debate amongst the managers. One manager claims that the team has made the playoffs every year they have had a win percentage of 0.50 or greater. Another manager says this is not true.

Let's use the below function and the .apply() method to see which manager is correct.

def calc_win_perc(wins, games_played):
    win_perc = wins / games_played
    return np.round(win_perc,2)

A DataFrame named dbacks_df has been loaded into your session.

Instructions 1/4
undefined XP
  • 1
  • 2
  • 3
  • 4
  • Print the first five rows of the dbacks_df DataFrame to see what the data looks like.