Lesson 44 · Real-World Data Analytics
Python Data Analytics #44: Historical NFL Wide Receiver Talent Analysis in Python
A fourth completely different sport in this sports analytics domain. A real FiveThirtyEight career-value model for real historical NFL wide receivers,…
- CourseReal-World Data Analytics
- Lesson44 of 100
- FormatJupyter notebook · 30 code cells
- Data2 datasets
What you'll learn
Datasets used in this lesson
Save these next to the notebook. In Google Colab, upload them with the 📁 icon on the left first.
📓 Full notebook
Download .ipynbData Analytics 100, Video 44: Real Historical NFL Wide Receiver Talent Analysis#
- Video forty-four of the hundred-video real-world data analytics series, a fourth completely different sport in this sports analytics domain.
- A real FiveThirtyEight career-value model for real historical NFL wide receivers, honestly scoped to what this real fetch reliably captured.
- Let's get into it.
This lesson is for learners who want to practise working honestly with a dataset that is only part of a bigger population, using American football as the setting. The business question: which historical NFL wide receivers produced the most career value, which measures line up with a Hall of Fame style rating, and at what age does a receiver's output stop growing?
You will use two FiveThirtyEight files. wr_advanced_historical.csv holds 961 players whose Pro Football Reference ID (pfr_player_id) falls alphabetically between A and Ce, because that is what the data fetch reliably captured. Its key columns are career_try (career True Receiving Yards, a volume measure), career_ranypa (an efficiency measure), career_wowy (described in the notebook as quarterback-independent value) and bcs_rating, a Hall of Fame rating available for only some players. try_per_game_aging_curve.csv shows the expected change in TRY per game from one age to the next.
In this lesson you will:
- profile skewed career statistics and rank players with
nlargestandnsmallest - work with a rated subset using
notna()and.copy() - compare correlations and read an aging curve
You should be comfortable with pandas filtering and describe(); see earlier lessons in the series if not.
Part 1: An Honest Real Scoping Note#
Before any analysis, you need to know exactly what your data covers. The code imports pandas, numpy and matplotlib, loads wr_advanced_historical.csv into receivers and shows its shape. The output, (961, 6), means 961 players and 6 columns. As the heading says, this is not every NFL receiver in history: it is the slice of players whose IDs fall alphabetically from A to Ce. Every result in this lesson describes that subset only, and stating this up front stops readers from over-generalising your findings.
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
receivers = pd.read_csv('wr_advanced_historical.csv')
receivers.shape
Part 2: Real Aging Curve Dataset#
The second file answers a different question: how does a receiver's output change as he gets older? pd.read_csv('try_per_game_aging_curve.csv') loads it into aging, and the output (24, 3) shows 24 rows and 3 columns. Each row describes one step from an age to the next, with the expected change in TRY per game. It is a small summary table rather than player-level data, so you will use it to describe a general pattern rather than to rank individuals.
aging = pd.read_csv('try_per_game_aging_curve.csv')
aging.shape
Part 3: Real Data Preview#
With unfamiliar abbreviations, the column list is your map of the data. The code calls receivers.head(5) and then receivers.columns.tolist(); Jupyter only displays the last expression, so you see the six column names. They are pfr_player_id, player_name, career_try, career_ranypa, career_wowy and bcs_rating. The three career columns measure volume, efficiency and value independent of the quarterback, and bcs_rating is the Hall of Fame style rating you will try to explain later.
receivers.head(5)
receivers.columns.tolist()
Part 4: Real Missing Data Check#
This step checks two things, but only the second result is displayed, because Jupyter shows the last expression in a cell. The first line counts missing values across the five core columns with a double .sum(). The second line uses notna().sum() to count how many players actually have a bcs_rating. The output is 43, which means 918 of the 961 players have no rating. That is not an error: the rating only exists for some players. You will confirm the core columns are complete in a later sanity check.
receivers[['pfr_player_id', 'player_name', 'career_try', 'career_ranypa', 'career_wowy']].isna().sum().sum()
receivers['bcs_rating'].notna().sum()
Part 5: Real Career Value Distribution#
Career totals are usually very uneven, so you need to look at the spread before ranking anyone. describe() on career_try shows a mean of about 1,000 True Receiving Yards but a median of only about 256. The maximum is about 14,181, and the minimum is slightly negative at about -6.2. When the mean is four times the median, a small number of long, productive careers are pulling the average up, while most players had short careers. For data shaped like this, the median is the better description of a typical player.
receivers['career_try'].describe()
Part 6: Real Most Productive Receivers#
Ranking by career volume shows who produced the most over their careers within this subset. receivers.nlargest(5, 'career_try') returns the five highest totals, keeping just the name and value. The output is led by Tim Brown at about 14,181, followed by Cris Carter (about 13,580), Isaac Bruce (about 13,160), Raymond Berry (about 12,290) and Fred Biletnikoff (about 11,923). These are well-known names, which is a reassuring sign the measure captures real career value. The table is saved as top_try for the final summary.
top_try = receivers.nlargest(5, 'career_try')[['player_name', 'career_try']]
top_try
Part 7: Real Least Productive Receivers#
The bottom of the ranking reveals something about who is in this file. nsmallest(5, 'career_try') returns the five lowest totals. The output shows George Blanda at about -6.2, Troy Aikman at about -5.7, then Bob Berry, Drew Bledsoe and Tony Adams. Several of these, including Aikman and Bledsoe, are famous quarterbacks rather than receivers. They appear because the file includes any player with receiving records, even a single catch. Always check whether a dataset contains people who do not really belong to the group you care about.
bottom_try = receivers.nsmallest(5, 'career_try')[['player_name', 'career_try']]
bottom_try
Part 8: Real Top Producers Chart#
A bar chart makes the top of the volume ranking easy to share. The code takes the ten highest career_try values with nlargest(10, ...), uses set_index('player_name') so names become bar labels, sorts with sort_values() so the largest bar sits at the top, and draws a horizontal bar chart with kind='barh'. The title notes the A to Ce subset, which is good practice. There is no displayed output because the figure is closed after saving as top_receivers.png. In the image, look at how closely the top five are grouped.
fig, ax = plt.subplots(figsize=(10, 6))
receivers.nlargest(10, 'career_try').set_index('player_name')['career_try'].sort_values().plot(kind='barh', ax=ax, color='teal')
ax.set_xlabel('Real Career True Receiving Yards')
ax.set_title('Real Top 10 Receivers by Career Value, A Through Ce Subset')
plt.tight_layout()
plt.savefig('top_receivers.png', dpi=100)
plt.close()
Part 9: Real Efficiency Distribution#
Efficiency tells a different story from volume: how productive a player was per opportunity rather than in total. describe() on career_ranypa shows a mean and median both close to -0.24, with values ranging from about -7.27 to 5.07. The mean and median almost match, so unlike career volume this measure is fairly balanced around its centre. Values below zero suggest below-average efficiency on this scale. The wide extremes are worth noting, because the next step shows where they come from.
receivers['career_ranypa'].describe()
Part 10: Real Most Efficient Receivers#
Ranking by efficiency is where small samples can mislead you. nlargest(5, 'career_ranypa') returns the five highest efficiency scores. The output is led by George Blanda at about 5.07, followed by Tony Adamle, Glenn Campbell, Jamie Caleb and Connie Mack Berry. Blanda also had the lowest career volume in this file, so his top efficiency almost certainly comes from very few receiving plays. A common mistake is to rank rate statistics without a minimum volume filter, which lets a handful of lucky plays top the list.
top_efficiency = receivers.nlargest(5, 'career_ranypa')[['player_name', 'career_ranypa']]
top_efficiency
Part 11: Real Wins-Over-Would-Be-Yours Distribution#
WOWY stands for with or without you: it compares how a team performs with and without a player, and the notebook uses it as a measure of value that does not depend on the quarterback. describe() on career_wowy shows a mean of about -0.10 and a median of about -0.06, with values from about -8.46 to 6.73. Like efficiency, it is centred close to zero with long tails at both ends. That shape again suggests that extreme values may come from players with very short careers.
receivers['career_wowy'].describe()
Part 12: Real Top WOWY Receivers#
Ranking by WOWY tests whether the same small-sample issue appears again. nlargest(5, 'career_wowy') returns the top five. The output is led by George Blanda at about 6.73, followed by John Batorski, Chuck Braidwood, Glenn Campbell and Blondy Black. Blanda tops this list too, and Glenn Campbell appears in both the efficiency and WOWY top five. When the same unexpected name leads several rankings, check how much data sits behind them before reporting them as stars.
top_wowy = receivers.nlargest(5, 'career_wowy')[['player_name', 'career_wowy']]
top_wowy
Part 13: Real Hall of Fame Rated Subset#
Only 43 players have a Hall of Fame rating, so you need a separate table to analyse them. receivers['bcs_rating'].notna() is True where a rating exists, and using it inside square brackets keeps only those rows. .copy() makes an independent copy, so later changes to rated will not trigger pandas warnings about modifying a slice of receivers. The output, (43, 6), confirms 43 rated players with all six columns. Every correlation you calculate from here uses only this small group.
rated = receivers[receivers['bcs_rating'].notna()].copy()
rated.shape
Part 14: Real Top Hall of Fame Ratings#
Ranking the rated players shows who the Hall of Fame model rates highest. rated.nlargest(5, 'bcs_rating') returns the top five. The output is led by Jim Benton at about 22.5, followed by Isaac Bruce (about 19.7), Lance Alworth (about 18.5), Raymond Berry (about 16.9) and Anthony Carter (about 15.1). Isaac Bruce and Raymond Berry also appear in the career volume top five, which hints at the link you will measure shortly. Jim Benton, by contrast, tops this list without appearing in the volume top five.
top_hof = rated.nlargest(5, 'bcs_rating')[['player_name', 'bcs_rating']]
top_hof
Part 15: Real Hall of Fame Ratings Chart#
A bar chart of the top ten ratings gives a clear visual of the rated group. The code follows the same pattern as the volume chart: nlargest(10, 'bcs_rating') on the rated table, set_index('player_name'), sort_values() and a horizontal bar chart, saved as top_hof_ratings.png. There is no displayed output because the figure is closed after saving. In the image, look for how far Jim Benton's bar extends beyond the others, and compare the names with the volume chart.
fig, ax = plt.subplots(figsize=(10, 6))
rated.nlargest(10, 'bcs_rating').set_index('player_name')['bcs_rating'].sort_values().plot(kind='barh', ax=ax, color='goldenrod')
ax.set_xlabel('Real BCS Hall of Fame Rating')
ax.set_title('Real Top 10 Hall of Fame Ratings, A Through Ce Subset')
plt.tight_layout()
plt.savefig('top_hof_ratings.png', dpi=100)
plt.close()
Part 16: Real Volume-to-Rating Correlation#
Now you test which career measure moves most with the Hall of Fame rating, starting with volume. Correlation measures how closely two columns move together, from -1 to 1. rated['career_try'].corr(rated['bcs_rating']) compares career volume with the rating among the 43 rated players. The output is 0.737, a fairly strong positive relationship: players with more career True Receiving Yards tend to have higher ratings. Remember this is based on only 43 players, so a few unusual careers could move it noticeably.
try_corr = round(rated['career_try'].corr(rated['bcs_rating']), 3)
try_corr
Part 17: Real Efficiency-to-Rating Correlation#
The same test for efficiency gives a very different answer. The code correlates career_ranypa with bcs_rating within the rated group. The output is 0.124, a weak positive relationship. Being efficient per opportunity, on its own, says little about a player's Hall of Fame rating in this subset. Compared with volume at 0.737, the message is that long, productive careers line up with the rating far more closely than per-play efficiency.
ranypa_corr = round(rated['career_ranypa'].corr(rated['bcs_rating']), 3)
ranypa_corr
Part 18: Real WOWY-to-Rating Correlation#
The final correlation checks quarterback-independent value. The code correlates career_wowy with bcs_rating. The output is 0.15, again weak, only slightly stronger than efficiency. So within these 43 players, career volume is the measure most closely linked to the rating, while efficiency and WOWY add little on their own. A weak correlation does not make a measure useless; it may capture something the rating simply does not reward.
wowy_corr = round(rated['career_wowy'].corr(rated['bcs_rating']), 3)
wowy_corr
Part 19: Real Aging Curve Preview#
Now you switch to the aging curve. The code calls aging.head(10) and then describe() on trypg_change; only the summary is displayed. The 24 values range from about -20.7 to 19.2, with a mean of about -2.6 and a median of about -3.7. The negative centre tells you that, across most age steps, expected TRY per game falls. The large positive maximum shows there are also steps with strong growth, most likely at younger ages. Plotting the curve, as you will shortly, makes the age pattern clear.
aging.head(10)
aging['trypg_change'].describe()
Part 20: Real Prime Age Window#
To find the turning point, you look for the age step where the expected change is closest to zero. (aging['trypg_change'] - 0).abs() gives each row's distance from zero, argsort() returns the row positions ordered from smallest distance upwards, [:1] keeps the first, and aging.iloc[...] pulls out that row. The output shows age 25 to 26, with a change of about 0.19. This suggests receivers stop growing around 25 or 26. Bear in mind that closest to zero is a simple rule; the chart helps confirm it is a genuine peak.
prime_row = aging.iloc[(aging['trypg_change'] - 0).abs().argsort()[:1]]
prime_row
Part 21: Real Aging Curve Chart#
The chart shows the full shape of the aging curve. The code plots age_from against trypg_change with circle markers, and ax.axhline(0, ...) draws a dashed grey line at zero, so you can see clearly where change switches from growth to decline. The figure is labelled and saved as aging_curve.png, with no displayed output because it is closed after saving. In the image, look for where the line crosses the dashed zero line around age 25 and how far it falls below zero at older ages.
fig, ax = plt.subplots(figsize=(10, 6))
ax.plot(aging['age_from'], aging['trypg_change'], marker='o', color='crimson')
ax.axhline(0, color='gray', linestyle='--')
ax.set_xlabel('Real Age')
ax.set_ylabel('Real Expected TRY Per Game Change')
ax.set_title('Real NFL Wide Receiver Aging Curve')
plt.tight_layout()
plt.savefig('aging_curve.png', dpi=100)
plt.close()
Part 22: Real Duplicate ID Check#
Each player should appear only once, otherwise counts and rankings would be inflated. receivers['pfr_player_id'].duplicated() marks True for any ID already seen in an earlier row, and .sum() counts them. The output is 0, so every ID is unique. Checking an ID column is safer than checking names: two different players can share a name, and in this file several players share surnames such as Berry.
receivers['pfr_player_id'].duplicated().sum()
Part 23: Real Alphabetical Scope Confirmation#
This step confirms the alphabetical scope described at the start. For text columns, .min() and .max() return the first and last values in alphabetical order. The output is ('AbbrDu20', 'CeleBr00'), so the IDs run from Abbr to Cele. This proves the file covers only part of the alphabet, roughly A to early C, and backs up the scoping note. It is a simple way to document a dataset's limits with evidence rather than an assumption.
receivers['pfr_player_id'].min(), receivers['pfr_player_id'].max()
Part 24: Saving the Real Rated Subset#
The rated subset is the most useful table for Hall of Fame questions, so it is worth saving. rated.to_csv('receivers_hof_rated.csv', index=False) writes the 43 rows without the index, which would otherwise appear as an extra unnamed column. The code reads it back and compares shapes. The output is True, so the saved file has the same 43 rows and 6 columns as the rated DataFrame.
rated.to_csv('receivers_hof_rated.csv', index=False)
reloaded = pd.read_csv('receivers_hof_rated.csv')
reloaded.shape == rated.shape
Part 25: Real Sanity Check, Row Count#
This sanity check confirms the main table has not changed size during the analysis. len(receivers) == 961 compares the current row count with the figure from the first step. The output is True. Creating rated as a separate copy did not alter receivers, which is exactly what .copy() is for. In a script you could wrap a check like this in assert.
len(receivers) == 961
Part 26: Real Sanity Check, No Duplicate IDs#
This repeats the duplicate ID check as a strict True or False test. duplicated().sum() == 0 returns True only if there are no repeated IDs. The output is np.True_, numpy's version of True, which appears because the count is a numpy number. It means exactly the same as a plain True. Writing checks as True or False tests makes them easy to collect into a final list of assertions.
receivers['pfr_player_id'].duplicated().sum() == 0
Part 27: Real Sanity Check, Aging Curve Complete#
The aging curve is small, so a single missing value would leave a visible gap in the chart. This check combines two conditions with and: the table has exactly 24 rows, and isna().sum().sum() == 0 confirms there are no missing values anywhere. The output is np.True_, so the aging table is complete. Checking both size and completeness together is a good habit for small reference tables.
len(aging) == 24 and aging.isna().sum().sum() == 0
Part 28: Real Sanity Check, Core Columns Complete#
Earlier, the missing-value count for the core columns ran but was not displayed, because only the last line in that cell showed. This step closes the gap. It counts missing values across career_try, career_ranypa and career_wowy and checks the total is zero. The output is np.True_, so all three career measures are complete for every one of the 961 players. Only bcs_rating has gaps, and that is by design.
receivers[['career_try', 'career_ranypa', 'career_wowy']].isna().sum().sum() == 0
Part 29: Real Top Finding Print#
Turning the main result into a sentence makes it ready for a report. The code takes the first row of top_try with .iloc[0], pulls out the name and rounds the value to one decimal place, then builds an f-string. The output reads: Tim Brown led this honestly-scoped subset with 14181.0 career True Receiving Yards. Notice the sentence itself mentions the subset, so the scope travels with the finding wherever it is copied.
top_receiver = top_try.iloc[0]['player_name']
top_receiver_try = round(top_try.iloc[0]['career_try'], 1)
print(f'{top_receiver} led this honestly-scoped subset with {top_receiver_try} real career True Receiving Yards.')
Part 30: Real Recap Print#
The final print gathers the main findings in one sentence. It uses len(receivers), len(rated) and the stored try_corr and wowy_corr inside an f-string. The output states that across 961 receivers in the A to Ce subset, 43 had a Hall of Fame rating, and career volume correlated with that rating at 0.737, versus 0.15 for quarterback-independent value. Building summaries from stored variables keeps them consistent with the analysis and avoids copying numbers by hand.
print(f'Across {len(receivers)} real receivers in this honest A-through-Ce subset, {len(rated)} had a real computed Hall of Fame rating, and career volume correlated with that rating at {try_corr}, versus {wowy_corr} for real quarterback-independent value.')
Wrap-Up: What You Learned#
- This real lesson was honestly scoped to real NFL wide receivers whose Pro Football Reference ID starts with the letters A through Ce, because that is what this real fetch reliably captured, not the full historical population.
- Within this real subset, real career volume and real quarterback-independent value both correlated with a real computed Hall of Fame rating, but neither one alone told the full real story.
- Real wide receiver performance genuinely peaks and declines with age, and this real aging curve dataset showed exactly where that real turning point falls.
- Being honest about a real dataset's scope, rather than quietly treating a partial real fetch as the full population, is a real core practice carried through every domain in this series.
- This real domain has now covered four genuinely different sports, basketball, tennis, baseball, and football, using four real independently sourced datasets.
- Next video: a real global soccer fan base dataset, looking at real TV audience share by country.
Practice on your own
- Re-rank
career_ranypaafter keeping only players withcareer_tryabove the median (about 256) and see whether George Blanda and the other surprise names drop out. - Within
rated, sort bybcs_ratingand add a column ranking each player bycareer_trywith.rank(ascending=False), then look for players whose two ranks differ the most. - Filter
agingto rows wheretrypg_changeis negative and find the firstage_fromat which the decline begins, then compare it with the closest-to-zero row.
When reading the wrap-up bullets, remember that only volume showed a strong link to the rating here (0.737), while quarterback-independent value was weak at 0.15. The next video in the series looks at a global soccer fan base dataset, focusing on TV audience share by country.
Found this useful?
All lessons, notebooks and datasets here are free. If they helped you, a coffee keeps new lessons coming.



