Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -326,6 +326,7 @@ app_ui = ui.page_fluid(
|
|
326 |
ui.input_date_range("scorer_date_id", "Streamer Stats Date Range",start = max(datetime.today().date()- timedelta(days=21),pd.to_datetime('2023-10-10')), end = datetime.today().date()),
|
327 |
ui.input_numeric('min_games','Min. Games (Streamers)',value=3),
|
328 |
ui.input_numeric('max_head','Number of Rows (Streamers)',value=15),
|
|
|
329 |
ui.output_table("result"),width=3),
|
330 |
|
331 |
|
@@ -348,11 +349,11 @@ app_ui = ui.page_fluid(
|
|
348 |
ui.tags.h3(""),
|
349 |
ui.div({"style": "font-size:2.7em;"},ui.output_text("txt_title_streamers")),
|
350 |
ui.tags.h5("Created By: @TJStats, Data: NHL, Natural Stat Trick, Yahoo Fantasy"),
|
351 |
-
ui.div({"style": "font-size:2em;"},
|
352 |
ui.div({"style": "font-size:1em;"},ui.output_text("txt_title_streamers_dates_f")),
|
353 |
ui.output_table("scorer_streamers_f"),
|
354 |
ui.tags.h3(""),
|
355 |
-
ui.div({"style": "font-size:2em;"},
|
356 |
ui.div({"style": "font-size:1em;"},ui.output_text("txt_title_streamers_dates_d")),
|
357 |
ui.output_table("scorer_streamers_d"),
|
358 |
|
@@ -362,11 +363,11 @@ app_ui = ui.page_fluid(
|
|
362 |
ui.tags.h3(""),
|
363 |
ui.div({"style": "font-size:2.7em;"},ui.output_text("txt_title_streamers_bang")),
|
364 |
ui.tags.h5("Created By: @TJStats, Data: NHL, Natural Stat Trick, Yahoo Fantasy"),
|
365 |
-
ui.div({"style": "font-size:2em;"},
|
366 |
ui.div({"style": "font-size:1em;"},ui.output_text("txt_title_streamers_dates_f_bang")),
|
367 |
ui.output_table("banger_streamers_f"),
|
368 |
ui.tags.h3(""),
|
369 |
-
ui.div({"style": "font-size:2em;"},
|
370 |
ui.div({"style": "font-size:1em;"},ui.output_text("txt_title_streamers_dates_d_bang")),
|
371 |
ui.output_table("banger_streamers_d"),
|
372 |
|
@@ -478,12 +479,32 @@ def server(input, output, session):
|
|
478 |
return f'Fantasy Hockey Scorers Streamers - Week {input.week_id()}'
|
479 |
else:
|
480 |
return f'Fantasy Hockey Scorers Streamers'
|
481 |
-
|
482 |
|
483 |
@output
|
484 |
@render.text
|
485 |
def txt_title_streamers_dates_f():
|
486 |
return f'2023-24 Season - {input.scorer_date_id()[0]} to {input.scorer_date_id()[1]} (min. {input.min_games()} GP)'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
487 |
|
488 |
@output
|
489 |
@render.text
|
@@ -784,7 +805,7 @@ def server(input, output, session):
|
|
784 |
df_dated_score_group['PP_percent'] = df_dated_score_group.PP_toi / df_dated_score_group.team_pp
|
785 |
df_dated_score_group = df_dated_score_group.reset_index()
|
786 |
df_dated_score_group = df_dated_score_group.merge(test_df[['Team','Off-Night']],left_on=['Team'],right_on=['Team'])
|
787 |
-
df_dated_score_group = df_dated_score_group[(df_dated_score_group.Team.isin(team_top))&(df_dated_score_group.percent_owned <= .
|
788 |
df_dated_score_group['TOI'] = ["%d:%02d" % (int(x),(x*60)%60) for x in df_dated_score_group['TOI'].astype(float)]
|
789 |
df_dated_score_group_table = df_dated_score_group[['Player','Team' ,'position', 'percent_owned', 'GP', 'TOI',
|
790 |
'Goals', 'ixG', 'Assists', 'Points', 'Shots', 'PP_Points', 'PP_percent','Off-Night']].sort_values(['Points','Off-Night','PP_percent','Goals','Shots'],ascending=False)
|
@@ -922,7 +943,7 @@ def server(input, output, session):
|
|
922 |
df_dated_score_group['PP_percent'] = df_dated_score_group.PP_toi / df_dated_score_group.team_pp
|
923 |
df_dated_score_group = df_dated_score_group.reset_index()
|
924 |
df_dated_score_group = df_dated_score_group.merge(test_df[['Team','Off-Night']],left_on=['Team'],right_on=['Team'])
|
925 |
-
df_dated_score_group = df_dated_score_group[(df_dated_score_group.Team.isin(team_top))&(df_dated_score_group.percent_owned <= .
|
926 |
df_dated_score_group['TOI'] = ["%d:%02d" % (int(x),(x*60)%60) for x in df_dated_score_group['TOI'].astype(float)]
|
927 |
df_dated_score_group_table = df_dated_score_group[['Player','Team' ,'position', 'percent_owned', 'GP', 'TOI',
|
928 |
'Goals', 'ixG', 'Assists', 'Points', 'Shots', 'PP_Points', 'PP_percent','Off-Night']].sort_values(['Points','Off-Night','PP_percent','Goals','Shots'],ascending=False)
|
@@ -1059,7 +1080,7 @@ def server(input, output, session):
|
|
1059 |
#df_dated_bangers_group['PP_percent'] = df_dated_bangers_group.PP_toi / df_dated_bangers_group.team_pp
|
1060 |
df_dated_bangers_group = df_dated_bangers_group.reset_index()
|
1061 |
df_dated_bangers_group = df_dated_bangers_group.merge(test_df[['Team','Off-Night']],left_on=['Team'],right_on=['Team'])
|
1062 |
-
df_dated_bangers_group = df_dated_bangers_group[(df_dated_bangers_group.Team.isin(team_top))&(df_dated_bangers_group.percent_owned <= .
|
1063 |
df_dated_bangers_group['TOI'] = ["%d:%02d" % (int(x),(x*60)%60) for x in df_dated_bangers_group['TOI'].astype(float)]
|
1064 |
df_dated_bangers_group_table = df_dated_bangers_group[['Player','Team' ,'position', 'percent_owned', 'GP', 'TOI',
|
1065 |
'Goals', 'Assists', 'Points', 'Shots', 'Hits', 'Blocks','S_H_B','Off-Night']].sort_values(['S_H_B','Off-Night','Shots','Hits','Blocks','Points'],ascending=False)
|
@@ -1199,7 +1220,7 @@ def server(input, output, session):
|
|
1199 |
#df_dated_bangers_group['PP_percent'] = df_dated_bangers_group.PP_toi / df_dated_bangers_group.team_pp
|
1200 |
df_dated_bangers_group = df_dated_bangers_group.reset_index()
|
1201 |
df_dated_bangers_group = df_dated_bangers_group.merge(test_df[['Team','Off-Night']],left_on=['Team'],right_on=['Team'])
|
1202 |
-
df_dated_bangers_group = df_dated_bangers_group[(df_dated_bangers_group.Team.isin(team_top))&(df_dated_bangers_group.percent_owned <= .
|
1203 |
df_dated_bangers_group['TOI'] = ["%d:%02d" % (int(x),(x*60)%60) for x in df_dated_bangers_group['TOI'].astype(float)]
|
1204 |
df_dated_bangers_group_table = df_dated_bangers_group[['Player','Team' ,'position', 'percent_owned', 'GP', 'TOI',
|
1205 |
'Goals', 'Assists', 'Points', 'Shots', 'Hits', 'Blocks','S_H_B','Off-Night']].sort_values(['S_H_B','Off-Night','Shots','Hits','Blocks','Points'],ascending=False)
|
|
|
326 |
ui.input_date_range("scorer_date_id", "Streamer Stats Date Range",start = max(datetime.today().date()- timedelta(days=21),pd.to_datetime('2023-10-10')), end = datetime.today().date()),
|
327 |
ui.input_numeric('min_games','Min. Games (Streamers)',value=3),
|
328 |
ui.input_numeric('max_head','Number of Rows (Streamers)',value=15),
|
329 |
+
ui.input_numeric('roster_p','Max Roster Percent% (Streamers)',value=50),
|
330 |
ui.output_table("result"),width=3),
|
331 |
|
332 |
|
|
|
349 |
ui.tags.h3(""),
|
350 |
ui.div({"style": "font-size:2.7em;"},ui.output_text("txt_title_streamers")),
|
351 |
ui.tags.h5("Created By: @TJStats, Data: NHL, Natural Stat Trick, Yahoo Fantasy"),
|
352 |
+
ui.div({"style": "font-size:2em;"},ui.output_text("txt_title_streamers_roster_f")),
|
353 |
ui.div({"style": "font-size:1em;"},ui.output_text("txt_title_streamers_dates_f")),
|
354 |
ui.output_table("scorer_streamers_f"),
|
355 |
ui.tags.h3(""),
|
356 |
+
ui.div({"style": "font-size:2em;"},ui.output_text("txt_title_streamers_roster_d")),
|
357 |
ui.div({"style": "font-size:1em;"},ui.output_text("txt_title_streamers_dates_d")),
|
358 |
ui.output_table("scorer_streamers_d"),
|
359 |
|
|
|
363 |
ui.tags.h3(""),
|
364 |
ui.div({"style": "font-size:2.7em;"},ui.output_text("txt_title_streamers_bang")),
|
365 |
ui.tags.h5("Created By: @TJStats, Data: NHL, Natural Stat Trick, Yahoo Fantasy"),
|
366 |
+
ui.div({"style": "font-size:2em;"},ui.output_text("txt_title_streamers_roster_f_bang")),
|
367 |
ui.div({"style": "font-size:1em;"},ui.output_text("txt_title_streamers_dates_f_bang")),
|
368 |
ui.output_table("banger_streamers_f"),
|
369 |
ui.tags.h3(""),
|
370 |
+
ui.div({"style": "font-size:2em;"},ui.output_text("txt_title_streamers_roster_d_bang")),
|
371 |
ui.div({"style": "font-size:1em;"},ui.output_text("txt_title_streamers_dates_d_bang")),
|
372 |
ui.output_table("banger_streamers_d"),
|
373 |
|
|
|
479 |
return f'Fantasy Hockey Scorers Streamers - Week {input.week_id()}'
|
480 |
else:
|
481 |
return f'Fantasy Hockey Scorers Streamers'
|
|
|
482 |
|
483 |
@output
|
484 |
@render.text
|
485 |
def txt_title_streamers_dates_f():
|
486 |
return f'2023-24 Season - {input.scorer_date_id()[0]} to {input.scorer_date_id()[1]} (min. {input.min_games()} GP)'
|
487 |
+
|
488 |
+
@output
|
489 |
+
@render.text
|
490 |
+
def txt_title_streamers_roster_f():
|
491 |
+
return f'Forwards Bangers Streamer Targets (<{input.roster_p()/100:.0%} Rostered)'
|
492 |
+
|
493 |
+
@output
|
494 |
+
@render.text
|
495 |
+
def txt_title_streamers_roster_d():
|
496 |
+
return f'Forwards Bangers Streamer Targets (<{input.roster_p()/100:.0%} Rostered)'
|
497 |
+
|
498 |
+
@output
|
499 |
+
@render.text
|
500 |
+
def txt_title_streamers_roster_f_bang():
|
501 |
+
return f'Forwards Bangers Streamer Targets (<{input.roster_p()/100:.0%} Rostered)'
|
502 |
+
|
503 |
+
|
504 |
+
@output
|
505 |
+
@render.text
|
506 |
+
def txt_title_streamers_roster_d_bang():
|
507 |
+
return f'Forwards Bangers Streamer Targets (<{input.roster_p()/100:.0%} Rostered)'
|
508 |
|
509 |
@output
|
510 |
@render.text
|
|
|
805 |
df_dated_score_group['PP_percent'] = df_dated_score_group.PP_toi / df_dated_score_group.team_pp
|
806 |
df_dated_score_group = df_dated_score_group.reset_index()
|
807 |
df_dated_score_group = df_dated_score_group.merge(test_df[['Team','Off-Night']],left_on=['Team'],right_on=['Team'])
|
808 |
+
df_dated_score_group = df_dated_score_group[(df_dated_score_group.Team.isin(team_top))&(df_dated_score_group.percent_owned <= input.roster_p()/100 )]
|
809 |
df_dated_score_group['TOI'] = ["%d:%02d" % (int(x),(x*60)%60) for x in df_dated_score_group['TOI'].astype(float)]
|
810 |
df_dated_score_group_table = df_dated_score_group[['Player','Team' ,'position', 'percent_owned', 'GP', 'TOI',
|
811 |
'Goals', 'ixG', 'Assists', 'Points', 'Shots', 'PP_Points', 'PP_percent','Off-Night']].sort_values(['Points','Off-Night','PP_percent','Goals','Shots'],ascending=False)
|
|
|
943 |
df_dated_score_group['PP_percent'] = df_dated_score_group.PP_toi / df_dated_score_group.team_pp
|
944 |
df_dated_score_group = df_dated_score_group.reset_index()
|
945 |
df_dated_score_group = df_dated_score_group.merge(test_df[['Team','Off-Night']],left_on=['Team'],right_on=['Team'])
|
946 |
+
df_dated_score_group = df_dated_score_group[(df_dated_score_group.Team.isin(team_top))&(df_dated_score_group.percent_owned <= input.roster_p()/100 )]
|
947 |
df_dated_score_group['TOI'] = ["%d:%02d" % (int(x),(x*60)%60) for x in df_dated_score_group['TOI'].astype(float)]
|
948 |
df_dated_score_group_table = df_dated_score_group[['Player','Team' ,'position', 'percent_owned', 'GP', 'TOI',
|
949 |
'Goals', 'ixG', 'Assists', 'Points', 'Shots', 'PP_Points', 'PP_percent','Off-Night']].sort_values(['Points','Off-Night','PP_percent','Goals','Shots'],ascending=False)
|
|
|
1080 |
#df_dated_bangers_group['PP_percent'] = df_dated_bangers_group.PP_toi / df_dated_bangers_group.team_pp
|
1081 |
df_dated_bangers_group = df_dated_bangers_group.reset_index()
|
1082 |
df_dated_bangers_group = df_dated_bangers_group.merge(test_df[['Team','Off-Night']],left_on=['Team'],right_on=['Team'])
|
1083 |
+
df_dated_bangers_group = df_dated_bangers_group[(df_dated_bangers_group.Team.isin(team_top))&(df_dated_bangers_group.percent_owned <= input.roster_p()/100 )]
|
1084 |
df_dated_bangers_group['TOI'] = ["%d:%02d" % (int(x),(x*60)%60) for x in df_dated_bangers_group['TOI'].astype(float)]
|
1085 |
df_dated_bangers_group_table = df_dated_bangers_group[['Player','Team' ,'position', 'percent_owned', 'GP', 'TOI',
|
1086 |
'Goals', 'Assists', 'Points', 'Shots', 'Hits', 'Blocks','S_H_B','Off-Night']].sort_values(['S_H_B','Off-Night','Shots','Hits','Blocks','Points'],ascending=False)
|
|
|
1220 |
#df_dated_bangers_group['PP_percent'] = df_dated_bangers_group.PP_toi / df_dated_bangers_group.team_pp
|
1221 |
df_dated_bangers_group = df_dated_bangers_group.reset_index()
|
1222 |
df_dated_bangers_group = df_dated_bangers_group.merge(test_df[['Team','Off-Night']],left_on=['Team'],right_on=['Team'])
|
1223 |
+
df_dated_bangers_group = df_dated_bangers_group[(df_dated_bangers_group.Team.isin(team_top))&(df_dated_bangers_group.percent_owned <= input.roster_p()/100 )]
|
1224 |
df_dated_bangers_group['TOI'] = ["%d:%02d" % (int(x),(x*60)%60) for x in df_dated_bangers_group['TOI'].astype(float)]
|
1225 |
df_dated_bangers_group_table = df_dated_bangers_group[['Player','Team' ,'position', 'percent_owned', 'GP', 'TOI',
|
1226 |
'Goals', 'Assists', 'Points', 'Shots', 'Hits', 'Blocks','S_H_B','Off-Night']].sort_values(['S_H_B','Off-Night','Shots','Hits','Blocks','Points'],ascending=False)
|