Last active
January 8, 2020 00:17
-
-
Save BlueSCar/e2f904cf46dcbc2204e8d98a58e90a21 to your computer and use it in GitHub Desktop.
Python - Normalizing /game/players endpoint
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
import pandas as pd | |
import requests | |
response = requests.get( | |
"https://api.collegefootballdata.com/games/players", | |
params={"year": 2019, "week": "1"} | |
) | |
records = pd.io.json.json_normalize( | |
response.json(), | |
['teams', 'categories', 'types', 'athletes'], | |
[ | |
'id', | |
['teams', 'school'], | |
['teams', 'conference'], | |
['teams', 'categories', 'name'], | |
['teams', 'categories', 'types', 'name'] | |
], | |
meta_prefix='game.' | |
) | |
records.head() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment