Skip to content

sravanpannala/NBA

Repository files navigation

NBA Analytics Projects by Sravan

Setup

  • Most of the code in this repo is written in Python or iPython (jupyter) notebooks. You need python to run the code.
  • You can install the packages required by this repo using poetry.
  • After installing poetry, just run
poetry install
  • This command will install all the packages used to run the different codes in this repo.
  • Some of the notebooks also contain R code along with python for creating pretty tables and charts. The R code in jupyter notebooks is handled by the rpy2 package, which is installed automatically using poetry
  • In addition to rpy2, running R code also requires a working R install.
  • The code in the R folder also requires R.

Project List

  1. Play-by-Play Related Stuff
    • Uses pbpstats API
    • Frustration fouls
    • Euro fouls for player and team
    • Coast-to-coast buckets and assists
    • Assists after offensive rebounds
    • Chasedown blocks?
  2. Plot Shot Charts
    • Plot location heat maps for NBA and WNBA
    • Plot shot hex map using NBA API and plotly
  3. Team Ratings
    • NBA SoS Adjusted Ratings
    • Adjusted Efficiency Landscape
    • Four Factor Analysis
    • Simple Win Loss Model using Rolling Net Rating
    • Rolling Team Ratings
  4. Leaderboards
    • Create Player Leaderboards in various categories
    • Create Team Leaderboards
  5. R based Visualizations and Analysis
    • Bad calls analysis based on L2M reports
    • NBA Histograms: Weighted Player Age Distribution
    • NBA Ratings aggregated from different sources
    • NBA Efficiency Landscape
  6. Import and Update Data
    • Using NBA API and pbpstats API
    • Save player data
    • Save league data
    • Update possession data
    • Import shot location data using NBA API
    • Get shot data using PBP Stats API
    • Import possession data for RAPM
    • Functions exist to import this data for use in other projects
  7. Player Analysis
    1. 3PT Shooting and FT Shooting Correlation
      • Using NBA API
      • Get different type of 3 PT shooting data
      • Find and plot correlations between them and FT shooting
    2. Wingspan and Defense Correlation
      • Using NBA API
      • Get wingspan, height and standing reach from draft data
      • Get rim protection data
      • Find and plot correlations
  8. Tweeting Bots (Might not work because of new Twitter API)
    • Uses Tweepy API
    • Gets Shot data from NBA API
    • Plots shotchart
    • Tweets out data and shotchart when you run this file
    • Added .bat file to enable automatic scheduling using Windows Task Scheduler
    • You need to apply for developer access and get your own authentication tokens to enable tweeting

About

Various NBA/WNBA analytics projects

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published