Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -134,6 +134,7 @@ season = 20232024
|
|
134 |
seasontype = 2
|
135 |
|
136 |
def nat_stat_trick_range_pp_gp(rookie='n',start_date='2022-10-01',end_date=str(pd.to_datetime(datetime.now(pytz.timezone('US/Pacific')).strftime('%Y-%m-%d')).date()),sit='all',gp=1):
|
|
|
137 |
url = f'https://www.naturalstattrick.com/playerteams.php?fromseason={season}&thruseason={season}&stype={seasontype}&sit=pp&score=all&stdoi=std&rate=y&team=ALL&pos=S&loc=B&toi=0&gpfilt=gpteam&fd=&td=&tgp='+str(gp)+'&lines=single&draftteam=ALL'
|
138 |
|
139 |
player_list_all = []
|
@@ -282,9 +283,11 @@ def server(input, output, session):
|
|
282 |
df_final = df_all_pp_1.merge( df_all_pp_2,how='outer',left_on=['player_id'],right_on=['player_id'],suffixes=("","_2"))
|
283 |
df_final = df_final.merge( df_all_pp_3,how='outer',left_on=['player_id'],right_on=['player_id'],suffixes=("_1","_3"))
|
284 |
|
285 |
-
|
286 |
team_report_1 = pd.read_html(f'https://www.naturalstattrick.com/teamtable.php?fromseason={season}&thruseason={season}&stype={seasontype}&sit=pp&score=all&rate=n&team=all&loc=B&gpf=c&gp='+str(n_1)+'&fd=&td=')[0]
|
|
|
287 |
team_report_2 = pd.read_html(f'https://www.naturalstattrick.com/teamtable.php?fromseason={season}&thruseason={season}&stype={seasontype}&sit=pp&score=all&rate=n&team=all&loc=B&gpf=c&gp='+str(n_2)+'&fd=&td=')[0]
|
|
|
288 |
team_report_3 = pd.read_html(f'https://www.naturalstattrick.com/teamtable.php?fromseason=fromseason={season}&thruseason={season}&stype={seasontype}&sit=pp&score=all&rate=n&team=all&loc=B&gpf=c&gp='+str(n_3)+'&fd=&td=')[0]
|
289 |
team_report_1 = team_report_1.merge(team_abv,left_on=['Team'],right_on=['team_name'],how='left')
|
290 |
team_report_2 = team_report_2.merge(team_abv,left_on=['Team'],right_on=['team_name'],how='left')
|
|
|
134 |
seasontype = 2
|
135 |
|
136 |
def nat_stat_trick_range_pp_gp(rookie='n',start_date='2022-10-01',end_date=str(pd.to_datetime(datetime.now(pytz.timezone('US/Pacific')).strftime('%Y-%m-%d')).date()),sit='all',gp=1):
|
137 |
+
time.sleep(2)
|
138 |
url = f'https://www.naturalstattrick.com/playerteams.php?fromseason={season}&thruseason={season}&stype={seasontype}&sit=pp&score=all&stdoi=std&rate=y&team=ALL&pos=S&loc=B&toi=0&gpfilt=gpteam&fd=&td=&tgp='+str(gp)+'&lines=single&draftteam=ALL'
|
139 |
|
140 |
player_list_all = []
|
|
|
283 |
df_final = df_all_pp_1.merge( df_all_pp_2,how='outer',left_on=['player_id'],right_on=['player_id'],suffixes=("","_2"))
|
284 |
df_final = df_final.merge( df_all_pp_3,how='outer',left_on=['player_id'],right_on=['player_id'],suffixes=("_1","_3"))
|
285 |
|
286 |
+
time.sleep(2)
|
287 |
team_report_1 = pd.read_html(f'https://www.naturalstattrick.com/teamtable.php?fromseason={season}&thruseason={season}&stype={seasontype}&sit=pp&score=all&rate=n&team=all&loc=B&gpf=c&gp='+str(n_1)+'&fd=&td=')[0]
|
288 |
+
time.sleep(2)
|
289 |
team_report_2 = pd.read_html(f'https://www.naturalstattrick.com/teamtable.php?fromseason={season}&thruseason={season}&stype={seasontype}&sit=pp&score=all&rate=n&team=all&loc=B&gpf=c&gp='+str(n_2)+'&fd=&td=')[0]
|
290 |
+
time.sleep(2)
|
291 |
team_report_3 = pd.read_html(f'https://www.naturalstattrick.com/teamtable.php?fromseason=fromseason={season}&thruseason={season}&stype={seasontype}&sit=pp&score=all&rate=n&team=all&loc=B&gpf=c&gp='+str(n_3)+'&fd=&td=')[0]
|
292 |
team_report_1 = team_report_1.merge(team_abv,left_on=['Team'],right_on=['team_name'],how='left')
|
293 |
team_report_2 = team_report_2.merge(team_abv,left_on=['Team'],right_on=['team_name'],how='left')
|