Exploring data using Python (Seaborn and Matplotlab)

Introduction

In this blog, I explored the dataset by Next Gen Stats tracking data for running NFL plays.

Data Set

For this blog, I have used the Kaggle data set — NFL Big Data Bowl.

Data Visualization

import pandas as pd
pd.plotting.register_matplotlib_converters()
import matplotlib.pyplot as plt
%matplotlib inline
import seaborn as sns
plt.figure(figsize=(14,6))
sns.lmplot(x='Week', y= 'S', hue='Team', data=df)
plt.ylabel('speed in yards/second')
plt.xlabel('week into the season')
plt.ylim(0, 10)
plt.figure(figsize=(14,6))
plt.title("Acceleration and speed range for NFL Big Bowl for seasons 2017-2019")
sns.lineplot(data=df['A'], label='Acceleration in yards/second^2')
sns.lineplot(data=df['S'], label='Speed in yards/second')
plt.xlabel('Seasons in NFL season')
plt.ylim(0, 5)
plt.figure(figsize=(14,10))
plt.title("Player Weight for NFL Big Bowl for seasons 2017-2019")
sns.distplot(a=df['PlayerWeight'],kde=False)
plt.xlabel('Player weight (lbs)')
plt.figure(figsize=(14,10))
plt.title("Player Weight for NFL Big Bowl for seasons 2017-2019")
sns.distplot(a=df['PlayerWeight'],kde=False)
plt.xlabel('Player weight (lbs)')
plt.figure(figsize=(8,8))
plt.title("The yardage gained on the play depending on whether we played at home or away")
sns.scatterplot(y=df['Yards'],x=df['Team'])
sns.jointplot(x=df['Temperature'], y=df['Humidity'], kind="kde")
#plt.title("Temperature vs Humidity")
#plt.xlabel("Temperature (deg F)")
plt.figure(figsize=(14,10))
sns.lmplot(x='Week', y="Yards", hue ='Quarter', data=df)
plt.xlim(0, 20)
plt.title("Yards vs Week into the season")
sns.kdeplot(data=df['YardLine'], shade=True)
plt.title("Yardline range")

Conclusions

  • The highest acceleration and speed were achieved in the 2018 season. Other than that both the variables are the same throughout the seasons.
  • The temperature was a bit higher in the 2019 season.
  • The weight of players varies from 160 lbs to 350 lbs. It generally keeps around 175, 225, and 325 lbs for low, medium, and heavy built individuals.
  • The yardline ranges between 0 to 50. The yardline usually lines mostly around 28.
  • The performance is approximately the same depending no matter whether they placed at home or away.

If you enjoyed this story, please click the 👏 button and share to help others find it! Feel free to leave a comment below.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store