Skip to content

sealneaward/nba-movement-data

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nba-movement-data

Ever since the nba stopped public access of their movement data, I though it would be good to have a copy of @neilmj data repo incase he deletes his data repo.

Credit: @neilmj

Data Setup

1.To unzip the 7z file run this command

cd data
sudo ./setup.sh

Additional Data Conversions

  1. Additional scripts are provided. To complete these steps, add your project directory to the constant.py file in the movement package.
import os
# change this data_dir for personal path
if os.environ['HOME'] == '/home/neil':
    data_dir = '/home/neil/projects/nba-movement-data'
else:
    raise Exception("Unspecified data_dir, unknown environment")
  1. Install the user package. You may need to run this in sudo.
python setup.py build
python setup.py install
  1. Convert the JSON files.
python movement/json_to_csv.py
  1. Convert the full-court to half-court. An explanation of moving the SportVU movement can be found here.
python movement/convert_movement.py
  1. The fixed shot times, along with the shot locations in half court space are in data/shots/fixed_shots.csv. They are formed from executing the script.
python fix_shot_times.py

In the fixing logic, the shot time is defined as the highest acceleration point before the ball reaches it's peak, within a defined window. The logic can be seen below. plot

Releases

No releases published

Packages

No packages published