Multichem commited on
Commit
c8a4d47
·
verified ·
1 Parent(s): 9a45b8f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -6
app.py CHANGED
@@ -36,16 +36,18 @@ def init_baselines():
36
  cell_vals = [row[0:13] for row in all_values[2:500]]
37
  frame_hold = pd.DataFrame(cell_vals, columns=['Player', 'Team', 'Salary', 'OwnAvg', 'PointsAvg', 'Points per $', 'blank', 'chop1', 'chop2', 'chop3', 'chop4', 'chop6', 'OPP'])
38
  flex_frame = frame_hold[['Player', 'Team', 'Salary', 'OwnAvg', 'PointsAvg', 'Points per $']]
 
39
  flex_frame = flex_frame.drop_duplicates(subset='Player')
40
  flex_frame = flex_frame.set_index('Player')
41
- flex_frame = flex_frame.sort_values(by='PointsAvg', ascending=False)
42
 
43
  for col in flex_frame.columns:
44
- try:
45
- flex_frame[col] = pd.to_numeric(flex_frame[col], errors='coerce')
46
- except ValueError:
47
- pass # Ignore columns that cannot be converted
48
-
 
 
49
  return flex_frame
50
 
51
  @st.cache_resource()
 
36
  cell_vals = [row[0:13] for row in all_values[2:500]]
37
  frame_hold = pd.DataFrame(cell_vals, columns=['Player', 'Team', 'Salary', 'OwnAvg', 'PointsAvg', 'Points per $', 'blank', 'chop1', 'chop2', 'chop3', 'chop4', 'chop6', 'OPP'])
38
  flex_frame = frame_hold[['Player', 'Team', 'Salary', 'OwnAvg', 'PointsAvg', 'Points per $']]
39
+ string_cols = ['Team', 'OwnAvg']
40
  flex_frame = flex_frame.drop_duplicates(subset='Player')
41
  flex_frame = flex_frame.set_index('Player')
 
42
 
43
  for col in flex_frame.columns:
44
+ if col not in string_cols:
45
+ try:
46
+ flex_frame[col] = pd.to_numeric(flex_frame[col], errors='coerce')
47
+ except ValueError:
48
+ pass # Ignore columns that cannot be converted
49
+
50
+ flex_frame = flex_frame.sort_values(by='PointsAvg', ascending=False)
51
  return flex_frame
52
 
53
  @st.cache_resource()