Created
March 17, 2022 12:09
-
-
Save databyjp/9fbfbdda9a36351692bf9ba9a3a5c252 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| gdf = shots_df.groupby("shot_zone").agg({"shot_made": "sum", "period": "count"}) | |
| gdf = gdf.reset_index().rename({"period": "shot_atts"}, axis=1) | |
| gdf = gdf.assign(team="NBA") | |
| gdf = gdf.assign(shot_freq=gdf.shot_atts / gdf.shot_atts.sum()) | |
| gdf = gdf.assign(shot_acc=gdf.shot_made / gdf.shot_atts) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment