Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -673,6 +673,7 @@ with tab3:
|
|
| 673 |
working_data = hitter_gamelog_table
|
| 674 |
player_var3 = st.selectbox("Which player are you viewing?", player_drop, key='player_var3')
|
| 675 |
plot_count = st.radio("how many stats would you like to plot?", ('One', 'Two', 'Three'), key='plot_count')
|
|
|
|
| 676 |
if plot_count == "One":
|
| 677 |
plot_var1 = st.selectbox("Which stat are you viewing?", stat_drop, key='plot_var1')
|
| 678 |
elif plot_count == "Two":
|
|
@@ -697,15 +698,34 @@ with tab3:
|
|
| 697 |
plot_high_date = pitcher_gamelog_table['Date'].max()
|
| 698 |
|
| 699 |
with col2:
|
|
|
|
| 700 |
working_data = working_data[working_data['Date'] >= sp_low_date]
|
| 701 |
working_data = working_data[working_data['Date'] <= sp_high_date]
|
| 702 |
working_data = working_data[working_data['Team'].isin(sp_team_var1)]
|
| 703 |
working_data = working_data[working_data['Player'] == player_var3]
|
| 704 |
if date_var_3 == '5-day Averages':
|
| 705 |
-
|
| 706 |
-
|
| 707 |
-
|
| 708 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 709 |
elif date_var_3 == '10-day Averages':
|
| 710 |
working_data['Date'] = pd.to_datetime(working_data['Date'])
|
| 711 |
working_data = working_data.set_index('Date')
|
|
|
|
| 673 |
working_data = hitter_gamelog_table
|
| 674 |
player_var3 = st.selectbox("Which player are you viewing?", player_drop, key='player_var3')
|
| 675 |
plot_count = st.radio("how many stats would you like to plot?", ('One', 'Two', 'Three'), key='plot_count')
|
| 676 |
+
|
| 677 |
if plot_count == "One":
|
| 678 |
plot_var1 = st.selectbox("Which stat are you viewing?", stat_drop, key='plot_var1')
|
| 679 |
elif plot_count == "Two":
|
|
|
|
| 698 |
plot_high_date = pitcher_gamelog_table['Date'].max()
|
| 699 |
|
| 700 |
with col2:
|
| 701 |
+
date_var_3 = '5-day Averages'
|
| 702 |
working_data = working_data[working_data['Date'] >= sp_low_date]
|
| 703 |
working_data = working_data[working_data['Date'] <= sp_high_date]
|
| 704 |
working_data = working_data[working_data['Team'].isin(sp_team_var1)]
|
| 705 |
working_data = working_data[working_data['Player'] == player_var3]
|
| 706 |
if date_var_3 == '5-day Averages':
|
| 707 |
+
if plot_count == "One":
|
| 708 |
+
working_data['Date'] = pd.to_datetime(working_data['Date'])
|
| 709 |
+
working_data = working_data.set_index('Date')
|
| 710 |
+
working_data = working_data[plot_var1].rolling('5D').mean()
|
| 711 |
+
working_data = working_data.reset_index()
|
| 712 |
+
elif plot_count == "Two":
|
| 713 |
+
working_data['Date'] = pd.to_datetime(working_data['Date'])
|
| 714 |
+
working_data = working_data.set_index('Date')
|
| 715 |
+
working_data1 = working_data[plot_var1].rolling('5D').mean()
|
| 716 |
+
working_data2 = working_data[plot_var2].rolling('5D').mean()
|
| 717 |
+
join_list = [working_data1, working_data2]
|
| 718 |
+
working_data - pd.concat(join_list, join='outer', axis=1)
|
| 719 |
+
working_data = working_data.reset_index()
|
| 720 |
+
elif plot_count == "Three":
|
| 721 |
+
working_data['Date'] = pd.to_datetime(working_data['Date'])
|
| 722 |
+
working_data = working_data.set_index('Date')
|
| 723 |
+
working_data1 = working_data[plot_var1].rolling('5D').mean()
|
| 724 |
+
working_data2 = working_data[plot_var2].rolling('5D').mean()
|
| 725 |
+
working_data3 = working_data[plot_var3].rolling('5D').mean()
|
| 726 |
+
join_list = [working_data1, working_data2, working_data3]
|
| 727 |
+
working_data - pd.concat(join_list, join='outer', axis=1)
|
| 728 |
+
working_data = working_data.reset_index()
|
| 729 |
elif date_var_3 == '10-day Averages':
|
| 730 |
working_data['Date'] = pd.to_datetime(working_data['Date'])
|
| 731 |
working_data = working_data.set_index('Date')
|