James McCool
commited on
Commit
·
2ac8839
1
Parent(s):
4727314
Remove unnecessary print statements from app.py and load_contest_file.py for cleaner code
Browse files- Eliminated print statements related to salary_dict and player information in both app.py and load_contest_file.py, enhancing code readability and reducing clutter in the output.
- Maintained existing functionality while streamlining the data handling process during contest file loading and player information retrieval.
- app.py +0 -2
- global_func/load_contest_file.py +0 -16
app.py
CHANGED
@@ -146,8 +146,6 @@ with tab1:
|
|
146 |
st.session_state['team_dict'] = dict(zip(st.session_state['team_df']['Player'], st.session_state['team_df']['Team']))
|
147 |
st.session_state['pos_dict'] = dict(zip(st.session_state['pos_df']['Player'], st.session_state['pos_df']['Pos']))
|
148 |
|
149 |
-
st.write(st.session_state['salary_dict'])
|
150 |
-
|
151 |
with tab2:
|
152 |
excluded_cols = ['BaseName', 'EntryCount']
|
153 |
if 'Contest' in st.session_state:
|
|
|
146 |
st.session_state['team_dict'] = dict(zip(st.session_state['team_df']['Player'], st.session_state['team_df']['Team']))
|
147 |
st.session_state['pos_dict'] = dict(zip(st.session_state['pos_df']['Player'], st.session_state['pos_df']['Pos']))
|
148 |
|
|
|
|
|
149 |
with tab2:
|
150 |
excluded_cols = ['BaseName', 'EntryCount']
|
151 |
if 'Contest' in st.session_state:
|
global_func/load_contest_file.py
CHANGED
@@ -48,8 +48,6 @@ def load_contest_file(upload, helper_var, helper = None, sport = None):
|
|
48 |
|
49 |
print('Made it through helper')
|
50 |
|
51 |
-
print(df_helper[df_helper['Player'] == 'Luis Torrens'])
|
52 |
-
|
53 |
contest_names = df.Player.unique()
|
54 |
if helper is not None:
|
55 |
helper_names = helper_df.Player.unique()
|
@@ -84,8 +82,6 @@ def load_contest_file(upload, helper_var, helper = None, sport = None):
|
|
84 |
|
85 |
df_helper['Player'] = df_helper['Player'].map(contest_match_dict)
|
86 |
df_helper = df_helper.drop_duplicates(subset='Player', keep='first')
|
87 |
-
|
88 |
-
print(df_helper[df_helper['Player'] == 'Luis Torrens'])
|
89 |
|
90 |
# Create separate dataframes for different player attributes
|
91 |
if helper is not None:
|
@@ -112,8 +108,6 @@ def load_contest_file(upload, helper_var, helper = None, sport = None):
|
|
112 |
elif sport == 'GOLF':
|
113 |
cleaned_df['Lineup'] = cleaned_df['Lineup'].replace([' P ', ' C ', '1B ', ' 2B ', ' 3B ', ' SS ', ' OF ', ' G ', 'G '], value=',', regex=True)
|
114 |
print(sport)
|
115 |
-
print(cleaned_df.head(10))
|
116 |
-
st.table(cleaned_df.head(10))
|
117 |
check_lineups = cleaned_df.copy()
|
118 |
if sport == 'MLB':
|
119 |
cleaned_df[['Remove', '1B', '2B', '3B', 'C', 'OF1', 'OF2', 'OF3', 'P1', 'P2', 'SS']] = cleaned_df['Lineup'].str.split(',', expand=True)
|
@@ -121,7 +115,6 @@ def load_contest_file(upload, helper_var, helper = None, sport = None):
|
|
121 |
cleaned_df[['Remove', 'Guy', 'Dude', 'Pooba', 'Bub', 'Chief', 'Buddy']] = cleaned_df['Lineup'].str.split(',', expand=True)
|
122 |
elif sport == 'GOLF':
|
123 |
cleaned_df[['Remove', 'Guy', 'Dude', 'Pooba', 'Bub', 'Chief', 'Buddy']] = cleaned_df['Lineup'].str.split(',', expand=True)
|
124 |
-
st.table(cleaned_df.head(10))
|
125 |
cleaned_df = cleaned_df.drop(columns=['Lineup', 'Remove'])
|
126 |
entry_counts = cleaned_df['BaseName'].value_counts()
|
127 |
cleaned_df['EntryCount'] = cleaned_df['BaseName'].map(entry_counts)
|
@@ -134,15 +127,6 @@ def load_contest_file(upload, helper_var, helper = None, sport = None):
|
|
134 |
st.table(cleaned_df.head(10))
|
135 |
|
136 |
print('Made it through check_lineups')
|
137 |
-
|
138 |
-
st.table(df['BaseName'].dropna())
|
139 |
-
st.table(cleaned_df)
|
140 |
-
st.table(ownership_df)
|
141 |
-
st.table(fpts_df)
|
142 |
-
st.table(salary_df)
|
143 |
-
st.table(team_df)
|
144 |
-
st.table(pos_df)
|
145 |
-
st.table(check_lineups)
|
146 |
|
147 |
# Get unique entry names
|
148 |
entry_list = list(set(df['BaseName'].dropna()))
|
|
|
48 |
|
49 |
print('Made it through helper')
|
50 |
|
|
|
|
|
51 |
contest_names = df.Player.unique()
|
52 |
if helper is not None:
|
53 |
helper_names = helper_df.Player.unique()
|
|
|
82 |
|
83 |
df_helper['Player'] = df_helper['Player'].map(contest_match_dict)
|
84 |
df_helper = df_helper.drop_duplicates(subset='Player', keep='first')
|
|
|
|
|
85 |
|
86 |
# Create separate dataframes for different player attributes
|
87 |
if helper is not None:
|
|
|
108 |
elif sport == 'GOLF':
|
109 |
cleaned_df['Lineup'] = cleaned_df['Lineup'].replace([' P ', ' C ', '1B ', ' 2B ', ' 3B ', ' SS ', ' OF ', ' G ', 'G '], value=',', regex=True)
|
110 |
print(sport)
|
|
|
|
|
111 |
check_lineups = cleaned_df.copy()
|
112 |
if sport == 'MLB':
|
113 |
cleaned_df[['Remove', '1B', '2B', '3B', 'C', 'OF1', 'OF2', 'OF3', 'P1', 'P2', 'SS']] = cleaned_df['Lineup'].str.split(',', expand=True)
|
|
|
115 |
cleaned_df[['Remove', 'Guy', 'Dude', 'Pooba', 'Bub', 'Chief', 'Buddy']] = cleaned_df['Lineup'].str.split(',', expand=True)
|
116 |
elif sport == 'GOLF':
|
117 |
cleaned_df[['Remove', 'Guy', 'Dude', 'Pooba', 'Bub', 'Chief', 'Buddy']] = cleaned_df['Lineup'].str.split(',', expand=True)
|
|
|
118 |
cleaned_df = cleaned_df.drop(columns=['Lineup', 'Remove'])
|
119 |
entry_counts = cleaned_df['BaseName'].value_counts()
|
120 |
cleaned_df['EntryCount'] = cleaned_df['BaseName'].map(entry_counts)
|
|
|
127 |
st.table(cleaned_df.head(10))
|
128 |
|
129 |
print('Made it through check_lineups')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
130 |
|
131 |
# Get unique entry names
|
132 |
entry_list = list(set(df['BaseName'].dropna()))
|