Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -76,11 +76,17 @@ unique_team_list = [120,
|
|
| 76 |
#Make an api call to get a dictionary of all teams
|
| 77 |
teams = requests.get(url='https://statsapi.mlb.com/api/v1/teams/').json()
|
| 78 |
#Select only teams that are at the MLB level
|
| 79 |
-
mlb_teams_city = [x['franchiseName'] for x in teams['teams'] if x['sport']['name'] == 'Major League Baseball']
|
| 80 |
-
mlb_teams_name = [x['teamName'] for x in teams['teams'] if x['sport']['name'] == 'Major League Baseball']
|
| 81 |
-
mlb_teams_franchise = [x['name'] for x in teams['teams'] if x['sport']['name'] == 'Major League Baseball']
|
| 82 |
-
mlb_teams_id = [x['id'] for x in teams['teams'] if x['sport']['name'] == 'Major League Baseball']
|
| 83 |
-
mlb_teams_abb = [x['abbreviation'] for x in teams['teams'] if x['sport']['name'] == 'Major League Baseball']
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
|
| 85 |
#Create a dataframe of all the teams
|
| 86 |
mlb_teams_df = pd.DataFrame(data={'team_id':mlb_teams_id,'city':mlb_teams_franchise,'name':mlb_teams_name,'franchise':mlb_teams_franchise,'abbreviation':mlb_teams_abb})
|
|
|
|
| 76 |
#Make an api call to get a dictionary of all teams
|
| 77 |
teams = requests.get(url='https://statsapi.mlb.com/api/v1/teams/').json()
|
| 78 |
#Select only teams that are at the MLB level
|
| 79 |
+
# mlb_teams_city = [x['franchiseName'] for x in teams['teams'] if x['sport']['name'] == 'Major League Baseball']
|
| 80 |
+
# mlb_teams_name = [x['teamName'] for x in teams['teams'] if x['sport']['name'] == 'Major League Baseball']
|
| 81 |
+
# mlb_teams_franchise = [x['name'] for x in teams['teams'] if x['sport']['name'] == 'Major League Baseball']
|
| 82 |
+
# mlb_teams_id = [x['id'] for x in teams['teams'] if x['sport']['name'] == 'Major League Baseball']
|
| 83 |
+
# mlb_teams_abb = [x['abbreviation'] for x in teams['teams'] if x['sport']['name'] == 'Major League Baseball']
|
| 84 |
+
|
| 85 |
+
mlb_teams_city = [x['franchiseName'] for x in teams['teams']]
|
| 86 |
+
mlb_teams_name = [x['teamName'] for x in teams['teams']]
|
| 87 |
+
mlb_teams_franchise = [x['name'] for x in teams['teams']]
|
| 88 |
+
mlb_teams_id = [x['id'] for x in teams['teams']]
|
| 89 |
+
mlb_teams_abb = [x['abbreviation'] for x in teams['teams']]
|
| 90 |
|
| 91 |
#Create a dataframe of all the teams
|
| 92 |
mlb_teams_df = pd.DataFrame(data={'team_id':mlb_teams_id,'city':mlb_teams_franchise,'name':mlb_teams_name,'franchise':mlb_teams_franchise,'abbreviation':mlb_teams_abb})
|