Matching to the nearest time
You decide to go back and look at punts as one type of dangerous play. One of your team's past challenges is that it has been hard to match play data to the timing of concussions throughout the season, especially for punts. You think pandas may be able to help here.
The data frame from your previous work, temps
, is already loaded. You also have a data frame called impacts
that includes the dates of each concussion occurring on punts. It also has a column showing the cumulative count of concussions for the season as of the latest occurrence. The data frames are shown on your screen.
Este exercício faz parte do curso
Pandas Joins for Spreadsheet Users
Instruções do exercício
- Combine the data to see how many concussions from punts have been recorded as of each game day in
temps
. Plot a run chart of cumulative concussions as of Cleveland and Dallas game dates. This has already been completed for you.
Exercício interativo prático
Experimente este exercício completando este código de exemplo.
# Combine data
temps_and_hits = pd.____(____, impacts[['cume_count']],
left_on=____, right_index=____)
# Plot cumulative concussions
temps_and_hits.plot.line('Game_Date', 'cume_count', grid=True)
plt.show()