Overview
Themisc.py script collects team-level play-type statistics and synergy sports data. It captures how teams score across different offensive actions (transition, isolation, pick-and-roll, post-ups, etc.) and provides efficiency metrics for each play type.
Data Source
API: NBA.com Stats APIEndpoint:
synergyplaytypes with various PlayType parameters
Functions
get_playtypes()
Retrieves team statistics for all offensive play types.List of season years to collect (e.g.,
[2023, 2024])Set to
True for playoff data, False for regular seasonPlayer (‘p’) or Team (‘t’) level data
Set to
True for defensive play-type data- Transition - Fast break opportunities
- Isolation - One-on-one offensive plays
- PRBallHandler - Pick and roll ball handler
- PRRollman - Pick and roll roll man
- Postup - Post-up plays
- Spotup - Spot-up shooting
- Handoff - Hand-off actions
- Cut - Cutting to the basket
- OffScreen - Off-screen actions
- OffRebound - Putbacks from offensive rebounds
- Misc - Miscellaneous play types
Output Files
teamplay.csv / teamplay_p.csv
Team offensive play-type statistics.NBA team ID
Team abbreviation
Full team name
Games played
Total possessions for this play type
Points scored on this play type
Field goals made
Field goal attempts
Field goal percentage (0-1 scale)
Free throws made
Free throw attempts
Free throw percentage (0-1 scale)
Turnovers on this play type
Turnover percentage (0-100%)
Shooting fouls drawn
Shooting foul percentage
And-one opportunities
Scoring percentage (0-100%)
Points per possession - key efficiency metric
Effective field goal percentage
Type of play: “trans”, “iso”, “bh”, “rollman”, “postup”, “spotup”, “handoff”, “cut”, “offscreen”, “putback”, “misc”
Season year
teamplayd.csv / teamplayd_p.csv
Team defensive play-type statistics (opponent performance against the defense). Same schema asteamplay.csv but represents offensive plays defended by the team.
Usage Examples
Collect Play-Type Data
Compare Play-Type Efficiency
Team Offensive Profile
Identify Strengths and Weaknesses
Defensive Play-Type Analysis
Analysis Use Cases
Offensive Identity
Understand team’s preferred offensive actions and where they generate most possessions
Defensive Scheme
Identify which play types a defense struggles to guard or excels at stopping
Efficiency Analysis
Find high-volume, high-efficiency play types for a team to emphasize
Matchup Preparation
Compare Team A’s offensive strengths against Team B’s defensive weaknesses
Key Metrics
PPP (Points Per Possession) is the primary efficiency metric:- Elite: > 1.10 PPP
- Good: 1.00 - 1.10 PPP
- Average: 0.90 - 1.00 PPP
- Poor: < 0.90 PPP
Configuration
Rate Limiting: Includes delays between API requests Season Format: UsesYYYY-YY format (e.g., “2023-24”)
API Headers: Requires standard NBA.com headers
Related Scripts
- new_tracking.py - Drives, catches, and touches data
- team_shooting.py - Team shooting by defender distance