CommencerCommencer gratuitement

Merging on two or more keys

You want to combine data for the plays occurring in each game. You have two data frames with different aspects of the plays. The frames are called play_times and play_yards.

The first 10 rows of each frame appear in your console. It looks like both frames use GameId and PlayId together to identify unique plays.

Cet exercice fait partie du cours

Pandas Joins for Spreadsheet Users

Afficher le cours

Instructions

  • Merge the data frames using the appropriate key column(s).
  • Check for duplicated key values using the .duplicated() and .sum() methods.

Exercice interactif pratique

Essayez cet exercice en complétant cet exemple de code.

# Merge data frames
plays = ____(play_times, ____, on=[____, ____])

# Check for duplicated values in key columns
plays.____(['GameId', 'PlayId']).____()
Modifier et exécuter le code