Aan de slagGa gratis aan de slag

Basic inner joins

It's possible that weather during a game is correlated with concussions. Looking at the weather data, you see it includes only the 2017 season. Even so, you want to join the data for games covered by both datasets.

The data frames of interest, games_places and weather_2017 are already loaded.

Deze oefening maakt deel uit van de cursus

Pandas Joins for Spreadsheet Users

Cursus bekijken

Oefeninstructies

  • View the first 5 lines of each data frame.
  • Join the data to include only games contained in both datasets.
  • View the data frame shapes to see the effect.

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

# View data frames
print(____.head())
print(____.head())

# Join data frames
games_weather = games_places.merge(____, on=____, how=____)
games_weather.shape
# View data frame shapes
print(games_places.shape)
print(weather_2017.shape)
print(games_weather.shape)
Code bewerken en uitvoeren