![]() defender_distance.loc = 'deandre jordan'] 725 field goal percentage has defenders guarding him from an average of just under three feet away. ![]() 33 field goal percentage which is less than half that of league leader DeAndre Jordan who's. Defenders are basically daring Miller to take open shots, which makes sense given his. ![]() defender_distance = df]ĭefender_distance.sort('avg_defender_distance',ascending=False)Īs you can see Mike Miller of the Cavaliers has the highest average distance of just over six feet. The first thing I was interested in finding was which player had the largest average defender distance when they shot. With everything in place it was time to start answering some questions with the data. cols = ĭf = pd.DataFrame(players,columns = cols) Now that I had all of the data in place I created a pandas dataframe to make sorting through everything much easier. I did this by iterating over every player in the teams dictionary and calling the find_stats function. The next step was getting all of the data. ![]() Shot_data = dataĭf = pd.DataFrame(shot_data,columns=headers)Īvg_def = df.mean(axis=1)Īvg_dribbles = df.mean(axis=1)Īvg_shot_distance = df.mean(axis=1)Īvg_touch_time = df.mean(axis=1) 'SeasonType=Regular+Season&TeamID=0&VsConference=&VsDivision=' 'Location=&Month=0&OpponentTeamID=0&Outcome=&Period=0&' + \ 'DateFrom=&DateTo=&GameSegment=&LastNGames=0&LeagueID=00&' + \ Below is an example of the Washington Wizard's dictionary with the player name as the key and the players id as the value, I wont show every team for the sake of space. I chose to use every player who has played in at least seventy percent of his team's games as this is the minimum the NBA uses to qualify players as a scoring leader. So my first step was creating a dictionary of all the players I wanted to collect data on. The API takes a player ID and returns all of the data for each shot in every game this season unless specified otherwise. The information I found the most interesting and focused on collecting were the distance the shot was taken from, the distance of the closest defender, the number of dribbles taken before the shot was taken, and the amount of time the player possessed the ball before shooting. These data points include how much time was left in the game when the shot was taken, time on the shot clock when the shot was taken, dribbles taken before the shot, and even the closest defender when the shot was taken. The shot log API from NBA.com returns data about every shot a player took during a game. I decided to dig a little deeper and see what I could find. The example he uses is the NBA's very own stats website, which to my surprise provides a lot of very interesting data. In it he goes over how to find and use API's to scrape data from webpages. Play-by-play data: source 1, source 2 (you only need the free data)īoxscore data 1990 to 2011 (If you find this information useful, consider spending $10 to support the folks at, where this data comes from.After a long weekend of NBA All-Star game festivities I stumbled upon Greg Reda's excellent blog post about web scraping on Twitter. If you need some help with introductory statistics topics, try some of the resources linked here. If someone submits their own work, be constructive. Independent research is greatly encouraged. team X had the most punt return yards in history). If you post content from your own site that is not appropriate for this subreddit, I will remove it and head straight to r/reportthespammers.Īrticles are welcome from sites like Advanced NFL Stats, Code and Football, and Football Outsiders.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |