nflfastR-Python-Tutorial icon indicating copy to clipboard operation
nflfastR-Python-Tutorial copied to clipboard

"Carries inside the five"

Open TheEditor opened this issue 4 years ago • 1 comments

"Carries inside the five" pops an error:

/usr/local/lib/python3.6/dist-packages/ipykernel_launcher.py:3: UserWarning: Boolean Series key will be reindexed to match DataFrame index. This is separate from the ipykernel package so we can avoid doing imports until

ValueError Traceback (most recent call last) in () 1 inside_5 = data[ 2 (data.yardline_100<5) & ----> 3 (df.play_type=='run') 4 ] 5

8 frames /usr/local/lib/python3.6/dist-packages/pandas/core/indexes/base.py in _can_reindex(self, indexer) 3283 # trying to reindex on an axis with duplicates 3284 if not self.is_unique and len(indexer): -> 3285 raise ValueError("cannot reindex from a duplicate axis") 3286 3287 def reindex(self, target, method=None, level=None, limit=None, tolerance=None):

ValueError: cannot reindex from a duplicate axis

TheEditor avatar Oct 12 '20 04:10 TheEditor

I think the lines

inside_5 = data[ (data.yardline_100<5) & (df.play_type=='run') ]

should read

inside_5 = df[ (df.yardline_100<5) & (df.play_type=='run') ]

TheEditor avatar Oct 13 '20 23:10 TheEditor