Get startedGet started for free

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.

This exercise is part of the course

Pandas Joins for Spreadsheet Users

View Course

Exercise instructions

  • 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.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# 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()
Edit and Run Code