nflfastR-Python-Tutorial
nflfastR-Python-Tutorial copied to clipboard
"Carries inside the five"
"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)
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
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') ]