New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

shot-chart

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

shot-chart

plotting shot charts from basketball-reference.com

  • 1.1.1
  • PyPI
  • Socket score

Maintainers
1

Shot Chart

Python module to plot NBA shot chart data and distributions for players and teams and some utilities.

This file will become your README and also the index of your documentation.

Install

pip install shot_chart

How to use

We first create a pandas dataframe from the source data.

shots_2019 = make_df(untar_data(URLs.SHOTS_2019))

Listing teams for the season

list_teams(shots_2019)
0            Atlanta
1            Orlando
183       Sacramento
184             Utah
341         Oklahoma
343     Golden State
511           Denver
512      New Orleans
675        Milwaukee
1016        Portland
1224         Phoenix
1226        Brooklyn
1412     San Antonio
1413         Memphis
1934         Toronto
2119    Philadelphia
2296       Minnesota
2477       LA Lakers
2655         Houston
2656     LA Clippers
2843       Charlotte
3017          Boston
3018      Washington
3383         Detroit
3918           Miami
5020       Cleveland
5535         Indiana
6407        New York
6410         Chicago
8473          Dallas
Name: team, dtype: object

Listing players who took at least 1 shot for a particular team

list_team_players(shots_2019, 'Portland')
.dataframe tbody tr th:only-of-type { vertical-align: middle; } .dataframe tbody tr th { vertical-align: top; } .dataframe thead th { text-align: right; }
shots_bycount
2CJ McCollum1212
5Damian Lillard1158
4Carmelo Anthony678
7Hassan Whiteside676
0Anfernee Simons522
6Gary Trent349
9Kent Bazemore322
10Mario Hezonja188
13Rodney Hood172
15Trevor Ariza159
12Nassir Little151
14Skal Labissière147
1Anthony Tolliver117
3Caleb Swanigan43
8Jaylen Hoard32
16Wenyen Gabriel29
17Zach Collins19
11Moses Brown10

Plotting team shot distribution

houston = TeamShots(shots_2019,"Houston")
houston.plot_shots()

png

houston.plot_shots(date_range=((2020,1,3), (2020,1,11)))

png

Please check the extra options when using the plotting functions

portland_20191125 = TeamShots(shots_2019,"Portland")
portland_20191125.list_game_ids(2019,11,25)
.dataframe tbody tr th:only-of-type { vertical-align: middle; } .dataframe tbody tr th { vertical-align: top; } .dataframe thead th { text-align: right; }
game_idwinnerloser
45560201911250CHIPortlandChicago
portland_20191125.plot_shots("201911250CHI")

png

Plotting player shot distribution

player_shots = PlayerShots(shots_2019,"Anthony Davis")
player_shots.plot_shots()

png

dlo = PlayerShots(shots_2019,"D'Angelo Russell")
dlo.plot_shots()

png

dlo.plot_shots(distance_limit=(16,26),attempt="2-pointer")

png

dlo.plot_effective(most_or_least="most")

png

dlo.plot_effective(most_or_least="most",exclude=["0ft"])

png

dlo.plot_effective(most_or_least="most",min_shots="auto",exclude=['2ft'])

png

dlo.plot_effective(most_or_least="least")

png

dlo.plot_effective(most_or_least="least",min_shots="auto")

png

Keywords

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc