NaN, or “Not a Number,” is a special floating-point value for undefined or unrepresentable numerical results. In play-by-play data, it can mark plays where no yards were available or where a play gained zero yards. section 6.2.2
Handle NaN values according to the meaning of the underlying data:
- Replace NaN with zero when the domain supports that interpretation, such as recording zero yards for a completed running or passing play. section 6.2.2
- Treat imputation as a modeling decision: inappropriate replacement can create excess zeros, distort minima, and affect predictions. section 6.2.2
>>> nfl_pbp['YARDS_GAINED'] = nfl_pbp['YARDS_GAINED'].fillna(0)
Use pandas fillna() to replace NaN values in YARDS_GAINED when zero is an appropriate domain interpretation. section 6.2.2








