Errata

Football Analytics with Python & R

Errata for Football Analytics with Python & R

Submit your own errata for this product.

The errata list is a list of errors and their corrections that were found after the product was released.

The following errata were submitted by our customers and have not yet been approved or disproved by the author or editor. They solely represent the opinion of the customer.

Color Key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted by Date submitted
Printed Page N/A
N/A

Hi,
I am currently reading your book "Football Analytics with Python & R" and I just started reading and I am trying to code as I read along. I am pretty new to both Python and R so I had a quick question. What is the easiest way to download the NFL files into my Python and R. Like the first thing in the book is using nflfastR and nfl_data_py respectively. I am looking online for help as well for how to actually download these packages, but I was wondering if you had a simpler answer for me to help. For R, I did install.packages("nflfastR") and then library("nflfastR"), but I am getting this error message.

Error: package or namespace load failed for ‘nflfastR’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
namespace ‘cli’ 3.6.0 is already loaded, but >= 3.6.1 is required
In addition: Warning message:
package ‘nflfastR’ was built under R version 4.2.3


I think I have the most up to date R downloaded, so that is why I am a little confused why I am getting that message. Then for python I don't really know where to start. I was trying to download the zip file, but was having trouble with that. Sorry I know this is very basic, but I just wanted to know the easiest way to get started with downloading the files I need or if I missed a very obvious step for how to do all of this. Thank you for your time!

Cole Miller  Jan 24, 2024 
Printed Page 14
3 paragraph

importing nfl_data_py does not work. Search for it in pycharm ide, found it but would not load, recieved error message. Tried to loaded through python termal with pip and install, still did not work

Attempted load with R. Does not work.

reginal b smith  Oct 27, 2023 
Printed Page 15
4th paragraph, 2nd section of code

For the 2nd line of code:

pbp_py_p.columns = list(map("_".join, pyp_py_p.columns.values))

it places to many underscores in the column name so that when I run the <print> statement I get the error -

UndefinedVariableError: name 'air_yards_count' is not defined

Looking at pbp_py_p, the column name is
a_______________________________________________________________i_______________________________________________________________r_______________________________________________________________________________________________________________________________y_______________________________________________________________a_______________________________________________________________r_______________________________________________________________d_______________________________________________________________s_______________________________________________________________________________________________________________________________c_______________________________________________________________o_______________________________________________________________u_______________________________________________________________n_______________________________________________________________t a_______________________________________________________________i_______________________________________________________________r_______________________________________________________________________________________________________________________________y_______________________________________________________________a_______________________________________________________________r_______________________________________________________________d_______________________________________________________________s_______________________________________________________________________________________________________________________________m_______________________________________________________________e_______________________________________________________________a_______________________________________________________________n
passer_id passer

Anonymous  Feb 13, 2024 
Printed Page 25
2

The python pandas ".describe" code is not working for me. Running MacOS and Python 3.10. I had to surround the statement that does ".describe" with a print() function. In other words:

pbp_py_p["passing_yards"].describe() does nothing...but

print(pbp_py_p["passing_yards"].describe()) returns expected results.

Jim McDonald  Oct 21, 2023 
Printed Page 49
last code block

In this Python code for a scatterplot that uses the previous year's yards per attempt to predict the current year's yards per attempt, shouldn't it say:

x = 'ypa_last', y='ypa'

sns.lmplot(data = pbp_py_p_s_pl, x = 'ypa', y= 'ypa_last', col = 'pass_length_air_yards');
plt.show();

Mike Batista  Jan 16, 2024 
Printed Page 53
Exercise 4

The possible error isn't actually on the page but it would be in the nfl_data_py package. Tom Brady was credited with minus-54 air yards on a play. I checked Pro Football Reference and the play occurred with 7:21 left in the fourth quarter in Week 7 of the 2022 season, a 21-3 loss at Carolina. It was an incomplete pass on 4th-and-7 to Cade Otton. No other pass play has less than minus-20 air yards.

Mike Batista  Jan 17, 2024 
Printed Page 59
last paragraph

The paragraph says to use displot(), but in the code block it's scatterplot, and the resulting Figure 3-1 is a scatterplot. So the error would be the displot().

Mike Batista  Jan 19, 2024 
Printed Page 291
Table C-1

when describing the "or" and "and" operators, the "(score > 2)" term was described as "score less than 2" ... which is not a big deal at all! just a tiny bit confusing when i read it

Colin Dunphy  Dec 11, 2023