Overview
Thehustle.py script collects hustle statistics from NBA.com’s tracking data, including deflections, loose balls recovered, screen assists, charges drawn, and box outs. It also merges player tracking movement data (distance, speed) and possession counts.
Data Sources
- NBA.com Hustle Stats:
leaguehustlestatsplayerendpoint - NBA.com Player Tracking:
leaguedashptstatsendpoint (SpeedDistance measure) - NBA.com Advanced Stats:
leaguedashplayerstatsendpoint (possessions)
Core Function
get_hustle()
Collects hustle statistics for a single season.Year to collect data for (e.g., 2025 for 2024-25 season)
Playoffs mode toggle
pd.DataFrame with hustle stats, speed/distance tracking, and possession counts merged
hustle_master()
Creates or updates the master hustle stats file.If True, processes playoff data
Statistics Collected
Hustle Stats
NBA player ID
Player name
Team abbreviation
Number of deflections (tipped passes or loose balls)
Loose balls recovered
Offensive fouls drawn by taking a charge
Screens that directly lead to a made field goal
Points generated from screen assists
Offensive box outs
Defensive box outs
Team rebounds resulting from player’s box out
Player rebounds resulting from their own box out
Number of shots contested
Two-point shots contested
Three-point shots contested
Speed/Distance Tracking
Total distance traveled in miles
Distance traveled on offense (miles)
Distance traveled on defense (miles)
Average speed (miles per hour)
Average speed on offense (mph)
Average speed on defense (mph)
Advanced Stats
Total possessions played
Minutes played
Games played
Data Merging Process
The script merges three separate API calls:Output Files
Regular season hustle stats (all years)Columns: All hustle stats + tracking data +
year columnPlayoff hustle stats (all years)Columns: Same as regular season file
Usage Example
Key Features
- Multi-source integration: Combines three different NBA.com endpoints
- Movement tracking: Links hustle plays to player speed and distance data
- Possession context: Includes possession counts for rate calculations
- Historical data: Maintains master files from previous seasons
- Playoff/regular season: Separate files for each season type
Analysis Use Cases
- Effort metrics: Deflections, loose balls, charges drawn
- Screening value: Screen assists and points generated
- Rebounding effort: Box out statistics
- Movement analysis: Distance covered and speed metrics
- Contest rates: Shot contests per possession or per minute