-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add notebook for get-game-logs endpoint
- Loading branch information
Showing
1 changed file
with
135 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"id": "09eea106-2f99-44ff-af4a-3d39c22c4f6e", | ||
"metadata": {}, | ||
"source": [ | ||
"This endpoint can be used to get game logs for a player/team/lineup" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 1, | ||
"id": "cfb95a7a-1b7a-4830-89bd-7456fc2c6cf3", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import requests" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "36800518-5756-4749-b424-ffb695d1496c", | ||
"metadata": {}, | ||
"source": [ | ||
"# Atlanta Hawks" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 2, | ||
"id": "98bab259-5b97-4bdc-9a37-28660c17290a", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"url = \"https://api.pbpstats.com/get-game-logs/nba\"\n", | ||
"params = {\n", | ||
" \"Season\": \"2021-22\", # To get for multiple seasons, separate seasons by comma\n", | ||
" \"SeasonType\": \"Regular Season\",\n", | ||
" \"EntityId\": \"1610612737\",\n", | ||
" \"EntityType\": \"Team\" # Use Opponent to get opponent stats\n", | ||
"}\n", | ||
"response = requests.get(url, params=params)\n", | ||
"response_json = response.json()\n", | ||
"totals = response_json['single_row_table_data']\n", | ||
"game_logs = response_json['multi_row_table_data']" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "3bad76c7-8568-4aec-8070-7548bee5a59f", | ||
"metadata": {}, | ||
"source": [ | ||
"# Al Horford, Marcus Smart, Jaylen Brown, Jayson Tatum, Robert Williams III" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 3, | ||
"id": "264ae561-56a4-4ca3-a765-56f8c3e76363", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"url = \"https://api.pbpstats.com/get-game-logs/nba\"\n", | ||
"params = {\n", | ||
" \"Season\": \"2021-22\", # To get for multiple seasons, separate seasons by comma\n", | ||
" \"SeasonType\": \"Regular Season\",\n", | ||
" \"EntityId\": \"1627759-1628369-1629057-201143-203935\",\n", | ||
" \"EntityType\": \"Lineup\" # Use LineupOpponent to get opponent stats\n", | ||
"}\n", | ||
"response = requests.get(url, params=params)\n", | ||
"response_json = response.json()\n", | ||
"totals = response_json['single_row_table_data']\n", | ||
"game_logs = response_json['multi_row_table_data']" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "3e275060-975e-440e-bbda-a745c45238da", | ||
"metadata": {}, | ||
"source": [ | ||
"### Nia Coffey" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 4, | ||
"id": "a8e6175c-99cd-438e-8518-7e64381cc433", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"url = \"https://api.pbpstats.com/get-game-logs/wnba\"\n", | ||
"params = {\n", | ||
" \"Season\": \"2021,2022\",\n", | ||
" \"SeasonType\": \"Regular Season\",\n", | ||
" \"EntityId\": \"1628269\",\n", | ||
" \"EntityType\": \"Player\"\n", | ||
"}\n", | ||
"response = requests.get(url, params=params)\n", | ||
"response_json = response.json()\n", | ||
"totals = response_json['single_row_table_data']\n", | ||
"game_logs = response_json['multi_row_table_data']" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "635e68c5-c9c1-4171-8537-af8fe2ab2ef7", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "playground", | ||
"language": "python", | ||
"name": "playground" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.8.9" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |