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
# Check keys of response | |
resp.json().keys() |
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
print(resp.text) |
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
resp.status_code == requests.codes.ok |
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
url = "https://api-football-v1.p.rapidapi.com/v2/leagues/seasonsAvailable/524" | |
headers = { | |
'x-rapidapi-host': "api-football-v1.p.rapidapi.com", | |
'x-rapidapi-key': api_key | |
} | |
resp = requests.request("GET", url, headers=headers) |
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
keys = get_keys("/Users/{your_username}/.secret/api_football.json") | |
api_key = keys['api_key'] |
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
def get_keys(path): | |
with open(path) as f: | |
return json.load(f) |
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
{“api_key”: “paste_your_actual_api_key_here”} |
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 requests | |
import pandas as pd | |
import json |
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
plot_confusion_matrix(knn, X_test, y_test, display_labels=['No Seizure', | |
'Seizure'], | |
normalize='true', cmap='Blues'); |
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
X = X[random_cols] | |
# Train-test-split | |
X_train, X_test, y_train, y_test = train_test_split(X, y, | |
test_size=0.25, | |
random_state=42) | |
# Perform feature scaling | |
scaler = StandardScaler() | |
X_train = scaler.fit_transform(X_train) |