nesticot commited on
Commit
11e3993
·
1 Parent(s): 0644a6f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +34 -18
app.py CHANGED
@@ -783,18 +783,20 @@ def server(input, output, session):
783
  df_dated_score_group[df_dated_score_group.columns[1:]] = df_dated_score_group[df_dated_score_group.columns[1:]].divide(df_dated_score_group.GP,axis=0)
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[(df_dated_score_group.Team.isin(team_top))&(df_dated_score_group.percent_owned <= .50 )]
787
  df_dated_score_group['TOI'] = ["%d:%02d" % (int(x),(x*60)%60) for x in df_dated_score_group['TOI'].astype(float)]
788
  df_dated_score_group_table = df_dated_score_group[['Player','Team' ,'position', 'percent_owned', 'GP', 'TOI',
789
- 'Goals', 'ixG', 'Assists', 'Points', 'Shots', 'PP_Points', 'PP_percent']].sort_values(['Points','PP_percent','Goals','Shots'],ascending=False)
790
 
791
  df_dated_score_group_table.columns = ['Player','Team' ,'Position', 'Roster%', 'GP', 'TOI/GP',
792
- 'Goals/GP', 'ixG/GP','Assists/GP', 'Points/GP', 'Shots/GP', 'PPP/GP', 'PP%']
793
 
794
 
795
 
796
- return df_dated_score_group_table[df_dated_score_group_table.Position != 'D'].head(input.max_head()).style.background_gradient(cmap=cmap_off, subset=['Points/GP']).background_gradient(cmap=cmap_total, subset=['Roster%']).hide_index().set_properties(**{'Height': '12px'},**{'text-align': 'center'})\
797
- .set_table_styles([{
 
798
  'selector': 'caption',
799
  'props': [
800
  ('color', ''),
@@ -919,15 +921,20 @@ def server(input, output, session):
919
  df_dated_score_group[df_dated_score_group.columns[1:]] = df_dated_score_group[df_dated_score_group.columns[1:]].divide(df_dated_score_group.GP,axis=0)
920
  df_dated_score_group['PP_percent'] = df_dated_score_group.PP_toi / df_dated_score_group.team_pp
921
  df_dated_score_group = df_dated_score_group.reset_index()
 
922
  df_dated_score_group = df_dated_score_group[(df_dated_score_group.Team.isin(team_top))&(df_dated_score_group.percent_owned <= .50 )]
923
  df_dated_score_group['TOI'] = ["%d:%02d" % (int(x),(x*60)%60) for x in df_dated_score_group['TOI'].astype(float)]
924
  df_dated_score_group_table = df_dated_score_group[['Player','Team' ,'position', 'percent_owned', 'GP', 'TOI',
925
- 'Goals', 'ixG', 'Assists', 'Points', 'Shots', 'PP_Points', 'PP_percent']].sort_values(['Points','PP_percent','Goals','Shots'],ascending=False)
926
 
927
  df_dated_score_group_table.columns = ['Player','Team' ,'Position', 'Roster%', 'GP', 'TOI/GP',
928
- 'Goals/GP', 'ixG/GP','Assists/GP', 'Points/GP', 'Shots/GP', 'PPP/GP', 'PP%']
929
 
930
- return df_dated_score_group_table[df_dated_score_group_table.Position == 'D'].head(input.max_head()).style.background_gradient(cmap=cmap_off, subset=['Points/GP']).background_gradient(cmap=cmap_total, subset=['Roster%']).hide_index().set_properties(**{'Height': '12px'},**{'text-align': 'center'})\
 
 
 
 
931
  .set_table_styles([{
932
  'selector': 'caption',
933
  'props': [
@@ -1051,18 +1058,24 @@ def server(input, output, session):
1051
  df_dated_bangers_group[df_dated_bangers_group.columns[1:]] = df_dated_bangers_group[df_dated_bangers_group.columns[1:]].divide(df_dated_bangers_group.GP,axis=0)
1052
  #df_dated_bangers_group['PP_percent'] = df_dated_bangers_group.PP_toi / df_dated_bangers_group.team_pp
1053
  df_dated_bangers_group = df_dated_bangers_group.reset_index()
 
1054
  df_dated_bangers_group = df_dated_bangers_group[(df_dated_bangers_group.Team.isin(team_top))&(df_dated_bangers_group.percent_owned <= .50 )]
1055
  df_dated_bangers_group['TOI'] = ["%d:%02d" % (int(x),(x*60)%60) for x in df_dated_bangers_group['TOI'].astype(float)]
1056
  df_dated_bangers_group_table = df_dated_bangers_group[['Player','Team' ,'position', 'percent_owned', 'GP', 'TOI',
1057
- 'Goals', 'Assists', 'Points', 'Shots', 'Hits', 'Blocks','S_H_B']].sort_values(['S_H_B','Shots','Hits','Blocks','Points'],ascending=False)
1058
 
1059
  df_dated_bangers_group_table.columns = ['Player','Team' ,'Position', 'Roster%', 'GP', 'TOI/GP',
1060
- 'Goals/GP', 'Assists/GP', 'Points/GP', 'Shots/GP', 'Hits/GP', 'Blocks/GP','S+H+B/GP']
1061
 
1062
  #df_dated_bangers_group_table.head(15)
1063
 
1064
- return df_dated_bangers_group_table[df_dated_bangers_group_table.Position != 'D'].head(input.max_head()).style.background_gradient(cmap=cmap_off, subset=['S+H+B/GP']).background_gradient(cmap=cmap_total, subset=['Roster%']).hide_index().set_properties(**{'Height': '12px'},**{'text-align': 'center'})\
1065
- .set_table_styles([{
 
 
 
 
 
1066
  'selector': 'caption',
1067
  'props': [
1068
  ('color', ''),
@@ -1185,18 +1198,24 @@ def server(input, output, session):
1185
  df_dated_bangers_group[df_dated_bangers_group.columns[1:]] = df_dated_bangers_group[df_dated_bangers_group.columns[1:]].divide(df_dated_bangers_group.GP,axis=0)
1186
  #df_dated_bangers_group['PP_percent'] = df_dated_bangers_group.PP_toi / df_dated_bangers_group.team_pp
1187
  df_dated_bangers_group = df_dated_bangers_group.reset_index()
 
1188
  df_dated_bangers_group = df_dated_bangers_group[(df_dated_bangers_group.Team.isin(team_top))&(df_dated_bangers_group.percent_owned <= .50 )]
1189
  df_dated_bangers_group['TOI'] = ["%d:%02d" % (int(x),(x*60)%60) for x in df_dated_bangers_group['TOI'].astype(float)]
1190
  df_dated_bangers_group_table = df_dated_bangers_group[['Player','Team' ,'position', 'percent_owned', 'GP', 'TOI',
1191
- 'Goals', 'Assists', 'Points', 'Shots', 'Hits', 'Blocks','S_H_B']].sort_values(['S_H_B','Shots','Hits','Blocks','Points'],ascending=False)
1192
 
1193
  df_dated_bangers_group_table.columns = ['Player','Team' ,'Position', 'Roster%', 'GP', 'TOI/GP',
1194
- 'Goals/GP', 'Assists/GP', 'Points/GP', 'Shots/GP', 'Hits/GP', 'Blocks/GP','S+H+B/GP']
1195
 
1196
  #df_dated_bangers_group_table.head(15)
1197
 
1198
- return df_dated_bangers_group_table[df_dated_bangers_group_table.Position == 'D'].head(input.max_head()).style.background_gradient(cmap=cmap_off, subset=['S+H+B/GP']).background_gradient(cmap=cmap_total, subset=['Roster%']).hide_index().set_properties(**{'Height': '12px'},**{'text-align': 'center'})\
1199
- .set_table_styles([{
 
 
 
 
 
1200
  'selector': 'caption',
1201
  'props': [
1202
  ('color', ''),
@@ -1214,9 +1233,6 @@ def server(input, output, session):
1214
  **{'min-width':'50px'},subset = ((df_dated_bangers_group_table.columns[1:])),overwrite=False)
1215
 
1216
 
1217
-
1218
-
1219
-
1220
 
1221
 
1222
 
 
783
  df_dated_score_group[df_dated_score_group.columns[1:]] = df_dated_score_group[df_dated_score_group.columns[1:]].divide(df_dated_score_group.GP,axis=0)
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 <= .50 )]
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)
791
 
792
  df_dated_score_group_table.columns = ['Player','Team' ,'Position', 'Roster%', 'GP', 'TOI/GP',
793
+ 'Goals/GP', 'ixG/GP','Assists/GP', 'Points/GP', 'Shots/GP', 'PPP/GP', 'PP%','Off-Night']
794
 
795
 
796
 
797
+ return df_dated_score_group_table[df_dated_score_group_table.Position != 'D'].head(input.max_head()).style.background_gradient(
798
+ cmap=cmap_off, subset=['Points/GP']).background_gradient(cmap=cmap_total, subset=['Roster%']).background_gradient(cmap=cmap_off, subset=['Off-Night'],vmin=0,vmax=df_dated_score_group_table['Off-Night'].max()).hide_index().set_properties(**{'Height': '12px'},**{'text-align': 'center'})\
799
+ .set_table_styles([{
800
  'selector': 'caption',
801
  'props': [
802
  ('color', ''),
 
921
  df_dated_score_group[df_dated_score_group.columns[1:]] = df_dated_score_group[df_dated_score_group.columns[1:]].divide(df_dated_score_group.GP,axis=0)
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 <= .50 )]
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)
929
 
930
  df_dated_score_group_table.columns = ['Player','Team' ,'Position', 'Roster%', 'GP', 'TOI/GP',
931
+ 'Goals/GP', 'ixG/GP','Assists/GP', 'Points/GP', 'Shots/GP', 'PPP/GP', 'PP%','Off-Night']
932
 
933
+ return df_dated_score_group_table[df_dated_score_group_table.Position == 'D'].head(input.max_head()) \
934
+ .style.background_gradient(cmap=cmap_off, subset=['Points/GP']) \
935
+ .background_gradient(cmap=cmap_total, subset=['Roster%']) \
936
+ .background_gradient(cmap=cmap_off, subset=['Off-Night'],vmin=0,vmax=df_dated_score_group_table['Off-Night'].max()) \
937
+ .hide_index().set_properties(**{'Height': '12px'},**{'text-align': 'center'})\
938
  .set_table_styles([{
939
  'selector': 'caption',
940
  'props': [
 
1058
  df_dated_bangers_group[df_dated_bangers_group.columns[1:]] = df_dated_bangers_group[df_dated_bangers_group.columns[1:]].divide(df_dated_bangers_group.GP,axis=0)
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 <= .50 )]
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)
1066
 
1067
  df_dated_bangers_group_table.columns = ['Player','Team' ,'Position', 'Roster%', 'GP', 'TOI/GP',
1068
+ 'Goals/GP', 'Assists/GP', 'Points/GP', 'Shots/GP', 'Hits/GP', 'Blocks/GP','S+H+B/GP','Off-Night']
1069
 
1070
  #df_dated_bangers_group_table.head(15)
1071
 
1072
+ return df_dated_bangers_group_table[df_dated_bangers_group_table.Position != 'D'] \
1073
+ .head(input.max_head()).style.background_gradient(cmap=cmap_off, subset=['S+H+B/GP'])\
1074
+ .background_gradient(cmap=cmap_total, subset=['Roster%'])\
1075
+ .background_gradient(cmap=cmap_off, subset=['Off-Night'],vmin=0,vmax=df_dated_bangers_group_table['Off-Night'].max())\
1076
+ .hide_index()\
1077
+ .set_properties(**{'Height': '12px'},**{'text-align': 'center'})\
1078
+ .set_table_styles([{
1079
  'selector': 'caption',
1080
  'props': [
1081
  ('color', ''),
 
1198
  df_dated_bangers_group[df_dated_bangers_group.columns[1:]] = df_dated_bangers_group[df_dated_bangers_group.columns[1:]].divide(df_dated_bangers_group.GP,axis=0)
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 <= .50 )]
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)
1206
 
1207
  df_dated_bangers_group_table.columns = ['Player','Team' ,'Position', 'Roster%', 'GP', 'TOI/GP',
1208
+ 'Goals/GP', 'Assists/GP', 'Points/GP', 'Shots/GP', 'Hits/GP', 'Blocks/GP','S+H+B/GP','Off-Night']
1209
 
1210
  #df_dated_bangers_group_table.head(15)
1211
 
1212
+ return df_dated_bangers_group_table[df_dated_bangers_group_table.Position == 'D']\
1213
+ .head(input.max_head()).style.background_gradient(cmap=cmap_off, subset=['S+H+B/GP'])\
1214
+ .background_gradient(cmap=cmap_total, subset=['Roster%'])\
1215
+ .background_gradient(cmap=cmap_off, subset=['Off-Night'],vmin=0,vmax=df_dated_bangers_group_table['Off-Night'].max())\
1216
+ .hide_index()\
1217
+ .set_properties(**{'Height': '12px'},**{'text-align': 'center'})\
1218
+ .set_table_styles([{
1219
  'selector': 'caption',
1220
  'props': [
1221
  ('color', ''),
 
1233
  **{'min-width':'50px'},subset = ((df_dated_bangers_group_table.columns[1:])),overwrite=False)
1234
 
1235
 
 
 
 
1236
 
1237
 
1238