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
.
Este exercício faz parte do curso
Pandas Joins for Spreadsheet Users
Instruções do exercício
- View each data frame to refresh your memory.
- Concatenate the data frames by consecutive season.
- Cross-tabulate
Season
andSeasonType
withpd.crosstab()
.
Exercício interativo prático
Experimente este exercício completando este código de exemplo.
# 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))