Last active
April 23, 2021 19:51
-
-
Save idcesares/d269b204d4f2cf9c1f847ef0417502b4 to your computer and use it in GitHub Desktop.
How to easily consume an Public API in Python and convert the result into a Pandas Dataframe
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
| # Basic libraries | |
| import requests | |
| import pandas as pd | |
| import json | |
| # Define API URL | |
| url = 'API_link' | |
| # Consume API | |
| response = requests.get(url).json() | |
| # Convert from Dictionary to Pandas Dataframe | |
| df = pd.DataFrame.from_dict(response) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment