Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -64,6 +64,7 @@ def True_AVG_Splits_load():
|
|
64 |
pitcher_stats = pd.DataFrame(worksheet.get_all_records())
|
65 |
pitcher_stats.apply(pd.to_numeric, errors='ignore')
|
66 |
pitcher_stats = pitcher_stats.drop(columns=['HWSr (LHH)', 'HWSr (RHH)', 'HWSr (Overall)', 'Weighted HWSr',])
|
|
|
67 |
pitcher_stats = pitcher_stats.sort_values(by='Weighted True AVG', ascending=True)
|
68 |
|
69 |
return pitcher_stats
|
@@ -76,6 +77,7 @@ def HWSr_Splits_load():
|
|
76 |
pitcher_stats = pd.DataFrame(worksheet.get_all_records())
|
77 |
pitcher_stats.apply(pd.to_numeric, errors='ignore')
|
78 |
pitcher_stats = pitcher_stats.drop(columns=['True AVG (LHH)', 'True AVG (RHH)', 'True AVG (Overall)', 'Weighted True AVG',])
|
|
|
79 |
pitcher_stats = pitcher_stats.sort_values(by='Weighted HWSr', ascending=True)
|
80 |
|
81 |
return pitcher_stats
|
@@ -87,6 +89,7 @@ def SP_Slate_Stats_load():
|
|
87 |
worksheet = sh.worksheet('Starting_Pitchers')
|
88 |
pitcher_stats = pd.DataFrame(worksheet.get_all_records())
|
89 |
pitcher_stats.apply(pd.to_numeric, errors='ignore')
|
|
|
90 |
pitcher_stats = pitcher_stats.loc[pitcher_stats['Playing'] == 1]
|
91 |
pitcher_stats = pitcher_stats.drop(columns=['Playing'])
|
92 |
pitcher_stats = pitcher_stats.sort_values(by='True AVG', ascending=True)
|
@@ -100,6 +103,7 @@ def RHH_load():
|
|
100 |
worksheet = sh.worksheet('Pitcher_Data (RHH)')
|
101 |
pitcher_stats = pd.DataFrame(worksheet.get_all_records())
|
102 |
pitcher_stats.apply(pd.to_numeric, errors='ignore')
|
|
|
103 |
pitcher_stats = pitcher_stats.loc[pitcher_stats['Playing'] == 1]
|
104 |
pitcher_stats = pitcher_stats.drop(columns=['Playing', 'Avg IP'])
|
105 |
pitcher_stats = pitcher_stats.sort_values(by='True AVG', ascending=True)
|
@@ -113,6 +117,7 @@ def LHH_load():
|
|
113 |
worksheet = sh.worksheet('Pitcher_Data (LHH)')
|
114 |
pitcher_stats = pd.DataFrame(worksheet.get_all_records())
|
115 |
pitcher_stats.apply(pd.to_numeric, errors='ignore')
|
|
|
116 |
pitcher_stats = pitcher_stats.loc[pitcher_stats['Playing'] == 1]
|
117 |
pitcher_stats = pitcher_stats.drop(columns=['Playing', 'Avg IP'])
|
118 |
pitcher_stats = pitcher_stats.sort_values(by='True AVG', ascending=True)
|
@@ -126,6 +131,7 @@ def Full_Stats_load():
|
|
126 |
worksheet = sh.worksheet('Pitcher_xData')
|
127 |
pitcher_stats = pd.DataFrame(worksheet.get_all_records())
|
128 |
pitcher_stats.apply(pd.to_numeric, errors='ignore')
|
|
|
129 |
pitcher_stats = pitcher_stats[['Player', 'PA', 'Hits', 'Singles', 'Doubles', 'Homeruns', 'Strikeoutper', 'Strikeouts', 'Walkper', 'Walks', 'xSLG', 'xwOBA', 'BABIP', 'AVG', 'xBA', 'True_AVG', 'xHRs']]
|
130 |
pitcher_stats = pitcher_stats.sort_values(by='PA', ascending=False)
|
131 |
pitcher_stats = pitcher_stats.drop_duplicates(subset='Player')
|
@@ -140,6 +146,7 @@ def Full_RHH_load():
|
|
140 |
worksheet = sh.worksheet('Pitcher_xData_RHH')
|
141 |
pitcher_stats = pd.DataFrame(worksheet.get_all_records())
|
142 |
pitcher_stats.apply(pd.to_numeric, errors='ignore')
|
|
|
143 |
pitcher_stats = pitcher_stats[['Player', 'PA', 'Hits', 'Singles', 'Doubles', 'Homeruns', 'Strikeoutper', 'Strikeouts', 'Walkper', 'Walks', 'xSLG', 'xwOBA', 'BABIP', 'AVG', 'xBA', 'True_AVG', 'xHRs']]
|
144 |
pitcher_stats = pitcher_stats.sort_values(by='PA', ascending=False)
|
145 |
pitcher_stats = pitcher_stats.drop_duplicates(subset='Player')
|
@@ -154,6 +161,7 @@ def Full_LHH_load():
|
|
154 |
worksheet = sh.worksheet('Pitcher_xData_LHH')
|
155 |
pitcher_stats = pd.DataFrame(worksheet.get_all_records())
|
156 |
pitcher_stats.apply(pd.to_numeric, errors='ignore')
|
|
|
157 |
pitcher_stats = pitcher_stats[['Player', 'PA', 'Hits', 'Singles', 'Doubles', 'Homeruns', 'Strikeoutper', 'Strikeouts', 'Walkper', 'Walks', 'xSLG', 'xwOBA', 'BABIP', 'AVG', 'xBA', 'True_AVG', 'xHRs']]
|
158 |
pitcher_stats = pitcher_stats.sort_values(by='PA', ascending=False)
|
159 |
pitcher_stats = pitcher_stats.drop_duplicates(subset='Player')
|
@@ -168,6 +176,7 @@ def Bullpen_Data_load():
|
|
168 |
worksheet = sh.worksheet('Bullpen_xData')
|
169 |
pitcher_stats = pd.DataFrame(worksheet.get_all_records())
|
170 |
pitcher_stats.apply(pd.to_numeric, errors='ignore')
|
|
|
171 |
for checkVar in range(len(wrong_acro)):
|
172 |
pitcher_stats['Names'] = pitcher_stats['Names'].replace(wrong_acro, right_acro)
|
173 |
pitcher_stats = pitcher_stats.sort_values(by='xSLG', ascending=False)
|
|
|
64 |
pitcher_stats = pd.DataFrame(worksheet.get_all_records())
|
65 |
pitcher_stats.apply(pd.to_numeric, errors='ignore')
|
66 |
pitcher_stats = pitcher_stats.drop(columns=['HWSr (LHH)', 'HWSr (RHH)', 'HWSr (Overall)', 'Weighted HWSr',])
|
67 |
+
pitcher_stats = pitcher_stats.dropna()
|
68 |
pitcher_stats = pitcher_stats.sort_values(by='Weighted True AVG', ascending=True)
|
69 |
|
70 |
return pitcher_stats
|
|
|
77 |
pitcher_stats = pd.DataFrame(worksheet.get_all_records())
|
78 |
pitcher_stats.apply(pd.to_numeric, errors='ignore')
|
79 |
pitcher_stats = pitcher_stats.drop(columns=['True AVG (LHH)', 'True AVG (RHH)', 'True AVG (Overall)', 'Weighted True AVG',])
|
80 |
+
pitcher_stats = pitcher_stats.dropna()
|
81 |
pitcher_stats = pitcher_stats.sort_values(by='Weighted HWSr', ascending=True)
|
82 |
|
83 |
return pitcher_stats
|
|
|
89 |
worksheet = sh.worksheet('Starting_Pitchers')
|
90 |
pitcher_stats = pd.DataFrame(worksheet.get_all_records())
|
91 |
pitcher_stats.apply(pd.to_numeric, errors='ignore')
|
92 |
+
pitcher_stats = pitcher_stats.dropna()
|
93 |
pitcher_stats = pitcher_stats.loc[pitcher_stats['Playing'] == 1]
|
94 |
pitcher_stats = pitcher_stats.drop(columns=['Playing'])
|
95 |
pitcher_stats = pitcher_stats.sort_values(by='True AVG', ascending=True)
|
|
|
103 |
worksheet = sh.worksheet('Pitcher_Data (RHH)')
|
104 |
pitcher_stats = pd.DataFrame(worksheet.get_all_records())
|
105 |
pitcher_stats.apply(pd.to_numeric, errors='ignore')
|
106 |
+
pitcher_stats = pitcher_stats.dropna()
|
107 |
pitcher_stats = pitcher_stats.loc[pitcher_stats['Playing'] == 1]
|
108 |
pitcher_stats = pitcher_stats.drop(columns=['Playing', 'Avg IP'])
|
109 |
pitcher_stats = pitcher_stats.sort_values(by='True AVG', ascending=True)
|
|
|
117 |
worksheet = sh.worksheet('Pitcher_Data (LHH)')
|
118 |
pitcher_stats = pd.DataFrame(worksheet.get_all_records())
|
119 |
pitcher_stats.apply(pd.to_numeric, errors='ignore')
|
120 |
+
pitcher_stats = pitcher_stats.dropna()
|
121 |
pitcher_stats = pitcher_stats.loc[pitcher_stats['Playing'] == 1]
|
122 |
pitcher_stats = pitcher_stats.drop(columns=['Playing', 'Avg IP'])
|
123 |
pitcher_stats = pitcher_stats.sort_values(by='True AVG', ascending=True)
|
|
|
131 |
worksheet = sh.worksheet('Pitcher_xData')
|
132 |
pitcher_stats = pd.DataFrame(worksheet.get_all_records())
|
133 |
pitcher_stats.apply(pd.to_numeric, errors='ignore')
|
134 |
+
pitcher_stats = pitcher_stats.dropna()
|
135 |
pitcher_stats = pitcher_stats[['Player', 'PA', 'Hits', 'Singles', 'Doubles', 'Homeruns', 'Strikeoutper', 'Strikeouts', 'Walkper', 'Walks', 'xSLG', 'xwOBA', 'BABIP', 'AVG', 'xBA', 'True_AVG', 'xHRs']]
|
136 |
pitcher_stats = pitcher_stats.sort_values(by='PA', ascending=False)
|
137 |
pitcher_stats = pitcher_stats.drop_duplicates(subset='Player')
|
|
|
146 |
worksheet = sh.worksheet('Pitcher_xData_RHH')
|
147 |
pitcher_stats = pd.DataFrame(worksheet.get_all_records())
|
148 |
pitcher_stats.apply(pd.to_numeric, errors='ignore')
|
149 |
+
pitcher_stats = pitcher_stats.dropna()
|
150 |
pitcher_stats = pitcher_stats[['Player', 'PA', 'Hits', 'Singles', 'Doubles', 'Homeruns', 'Strikeoutper', 'Strikeouts', 'Walkper', 'Walks', 'xSLG', 'xwOBA', 'BABIP', 'AVG', 'xBA', 'True_AVG', 'xHRs']]
|
151 |
pitcher_stats = pitcher_stats.sort_values(by='PA', ascending=False)
|
152 |
pitcher_stats = pitcher_stats.drop_duplicates(subset='Player')
|
|
|
161 |
worksheet = sh.worksheet('Pitcher_xData_LHH')
|
162 |
pitcher_stats = pd.DataFrame(worksheet.get_all_records())
|
163 |
pitcher_stats.apply(pd.to_numeric, errors='ignore')
|
164 |
+
pitcher_stats = pitcher_stats.dropna()
|
165 |
pitcher_stats = pitcher_stats[['Player', 'PA', 'Hits', 'Singles', 'Doubles', 'Homeruns', 'Strikeoutper', 'Strikeouts', 'Walkper', 'Walks', 'xSLG', 'xwOBA', 'BABIP', 'AVG', 'xBA', 'True_AVG', 'xHRs']]
|
166 |
pitcher_stats = pitcher_stats.sort_values(by='PA', ascending=False)
|
167 |
pitcher_stats = pitcher_stats.drop_duplicates(subset='Player')
|
|
|
176 |
worksheet = sh.worksheet('Bullpen_xData')
|
177 |
pitcher_stats = pd.DataFrame(worksheet.get_all_records())
|
178 |
pitcher_stats.apply(pd.to_numeric, errors='ignore')
|
179 |
+
pitcher_stats = pitcher_stats.dropna()
|
180 |
for checkVar in range(len(wrong_acro)):
|
181 |
pitcher_stats['Names'] = pitcher_stats['Names'].replace(wrong_acro, right_acro)
|
182 |
pitcher_stats = pitcher_stats.sort_values(by='xSLG', ascending=False)
|