Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -36,7 +36,7 @@ warnings.filterwarnings('ignore')
|
|
36 |
# import yahoo_oauth
|
37 |
import json
|
38 |
#import openpyxl
|
39 |
-
|
40 |
from datetime import timedelta
|
41 |
import dataframe_image as dfi
|
42 |
# from google.colab import drive
|
@@ -47,11 +47,11 @@ def percentile(n):
|
|
47 |
return percentile_
|
48 |
|
49 |
import os
|
50 |
-
|
51 |
import matplotlib.pyplot as plt
|
52 |
import matplotlib.colors
|
53 |
import matplotlib.colors as mcolors
|
54 |
-
|
55 |
#import pybaseball
|
56 |
import math
|
57 |
import matplotlib.ticker as mtick
|
@@ -329,6 +329,7 @@ def server(input, output, session):
|
|
329 |
print(list_of_columns)
|
330 |
test = test[list_of_columns]
|
331 |
test = test.rename(columns={'percent_owned':'Roster%'})
|
|
|
332 |
|
333 |
|
334 |
top_d_score = test[(test.Team==input.team_id())].sort_values(by=['L'+str(n_1)+' PP%'],ascending=False).reset_index(drop=True)
|
@@ -371,17 +372,22 @@ def server(input, output, session):
|
|
371 |
('text-align', 'centre'),
|
372 |
]
|
373 |
|
374 |
-
},{'selector' :'th', 'props':[('text-align', 'center'),('Height','px'),('color','black'),(
|
375 |
-
|
|
|
376 |
[{'selector': 'th:first-child', 'props': [('background-color', 'white')]}],overwrite=False).set_table_styles(
|
377 |
[{'selector': 'tr:first-child', 'props': [('background-color', 'white')]}],overwrite=False).set_table_styles(
|
378 |
[{'selector': 'tr', 'props': [('line-height', '20px')]}],overwrite=False).set_properties(
|
379 |
-
**{'Height': '8px'},**{'text-align': 'center'},overwrite=False).
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
|
|
|
|
|
|
|
|
385 |
|
386 |
return df_style_bang
|
387 |
|
|
|
36 |
# import yahoo_oauth
|
37 |
import json
|
38 |
#import openpyxl
|
39 |
+
from sklearn import preprocessing
|
40 |
from datetime import timedelta
|
41 |
import dataframe_image as dfi
|
42 |
# from google.colab import drive
|
|
|
47 |
return percentile_
|
48 |
|
49 |
import os
|
50 |
+
import praw
|
51 |
import matplotlib.pyplot as plt
|
52 |
import matplotlib.colors
|
53 |
import matplotlib.colors as mcolors
|
54 |
+
cmap_sum = matplotlib.colors.LinearSegmentedColormap.from_list("", ["#4285f4","#FFFFFF","#F0E442"])
|
55 |
#import pybaseball
|
56 |
import math
|
57 |
import matplotlib.ticker as mtick
|
|
|
329 |
print(list_of_columns)
|
330 |
test = test[list_of_columns]
|
331 |
test = test.rename(columns={'percent_owned':'Roster%'})
|
332 |
+
test = test.rename(columns={'display_position':'Position'})
|
333 |
|
334 |
|
335 |
top_d_score = test[(test.Team==input.team_id())].sort_values(by=['L'+str(n_1)+' PP%'],ascending=False).reset_index(drop=True)
|
|
|
372 |
('text-align', 'centre'),
|
373 |
]
|
374 |
|
375 |
+
},{'selector' :'th', 'props':[('text-align', 'center'),('Height','px'),('color','black'),(
|
376 |
+
'border', '1px black solid !important')]},{'selector' :'td', 'props':[('text-align', 'center'),('font-size', '18px'),('color','black')]}],overwrite=False).set_properties(
|
377 |
+
**{'background-color':'White','index':'White','min-width':'50px'},overwrite=False).set_table_styles(
|
378 |
[{'selector': 'th:first-child', 'props': [('background-color', 'white')]}],overwrite=False).set_table_styles(
|
379 |
[{'selector': 'tr:first-child', 'props': [('background-color', 'white')]}],overwrite=False).set_table_styles(
|
380 |
[{'selector': 'tr', 'props': [('line-height', '20px')]}],overwrite=False).set_properties(
|
381 |
+
**{'Height': '8px'},**{'text-align': 'center'},overwrite=False).set_properties(**{'border': '3 px','color':'black'},overwrite=False).set_properties(**{'border': '3 px','color':'black'},overwrite=False).set_properties(
|
382 |
+
**{'border': '1px black solid !important'},subset = ((list(top_d_score.index[:]),top_d_score.columns[:]))).set_properties(
|
383 |
+
**{'min-width':'130'},subset = ((list(top_d_score.index[:]),top_d_score.columns[:])),overwrite=False).set_properties(**{
|
384 |
+
'color': 'black'},overwrite=False).set_properties(
|
385 |
+
**{'border': '1px black solid !important'},subset = ((list(top_d_score.index[:]),top_d_score.columns[:]))).format(
|
386 |
+
{'L'+str(n_1)+' PP%': '{:.0%}',
|
387 |
+
'L'+str(n_2)+' PP%': '{:.0%}',
|
388 |
+
'L'+str(n_3)+' PP%': '{:.0%}',
|
389 |
+
'Roster%': '{:.0%}',
|
390 |
+
},).background_gradient(cmap=co, subset=[x for x in cols if x.endswith('PP%')]+['Roster%'])
|
391 |
|
392 |
return df_style_bang
|
393 |
|