Concatenating rows
You and the team are ready to continue the project to reduce player concussions in the NFL. Previously you looked at game data from the 2016 and 2017 seasons and determined that the data should be joined. Among other things, it will help you to compare the number of games for each season by season type.
Data from both seasons have been loaded into two data frames, games_2016
and games_2017
. Please assume for this exercise and all remaining exercises, that pandas
has been imported as pd
.
Diese Übung ist Teil des Kurses
Pandas Joins for Spreadsheet Users
Anleitung zur Übung
- View each data frame to refresh your memory.
- Concatenate the data frames by consecutive season.
- Cross-tabulate
Season
andSeasonType
withpd.crosstab()
.
Interaktive Übung
Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.
# View 2016 and 2017 games
print(____)
____(games_2017)
# Concatenate data frames
games = ____([____, ____])
# Cross-tabulate Season and Season Type
print(pd.crosstab(games.Season, games.SeasonType))