nesticot commited on
Commit
e54bed1
·
verified ·
1 Parent(s): cc8fd7e

Update rolling_batter_functions.py

Browse files
Files changed (1) hide show
  1. rolling_batter_functions.py +2 -3
rolling_batter_functions.py CHANGED
@@ -200,7 +200,7 @@ def rolling_plot(df,df_summ,player_id,stat_id,batter_dict,window_select,level_id
200
 
201
  #sns.scatterplot(x=data_df.launch_speed_90,y=data_df.zone_contact,color=colour_palette[0],s=75,label=int(player_id))
202
 
203
- df_summ_new_select = df_summ_new[df_summ_new.batter_id == int(player_id)].reset_index(drop=True)
204
  print('whiffing')
205
  print(df)
206
  print('Player _df:')
@@ -305,7 +305,6 @@ def rolling_plot(df,df_summ,player_id,stat_id,batter_dict,window_select,level_id
305
 
306
  ax.hlines(y=elly_zone_df[plot_dict[stat_id]["x_value"]].sum()/elly_zone_df[divisor_x].sum(),xmin=swing_min,xmax=len(elly_zone_df),color=colour_palette[0],linestyle='--',label=label_2)
307
 
308
- elly_zone_df = elly_zone_df.sort_values(by='start_time',ascending=False)
309
  sns.lineplot(x=range(1,len(elly_zone_df)+1),y=elly_zone_df[plot_dict[stat_id]["x_value"]].fillna(0).rolling(window=swing_min).sum()/swing_min,color=colour_palette[0],linewidth=3,ax=ax)
310
 
311
 
@@ -317,7 +316,7 @@ def rolling_plot(df,df_summ,player_id,stat_id,batter_dict,window_select,level_id
317
  ax.hlines(y=elly_zone_df[plot_dict[stat_id]["x_value"]].fillna(0).quantile(0.9),xmin=swing_min,xmax=len(elly_zone_df),color=colour_palette[0],linestyle='--',label=label_2)
318
 
319
 
320
- elly_zone_df = elly_zone_df.sort_values(by='start_time',ascending=False)
321
  sns.lineplot(x=range(1,len(elly_zone_df)+1),y=elly_zone_df[plot_dict[stat_id]["x_value"]].fillna(0).rolling(window=swing_min).quantile(0.9),color=colour_palette[0],linewidth=3,ax=ax)
322
 
323
 
 
200
 
201
  #sns.scatterplot(x=data_df.launch_speed_90,y=data_df.zone_contact,color=colour_palette[0],s=75,label=int(player_id))
202
 
203
+ df_summ_new_select = df_summ_new[df_summ_new.batter_id == int(player_id)].reset_index(drop=True).sort_values('start_time')
204
  print('whiffing')
205
  print(df)
206
  print('Player _df:')
 
305
 
306
  ax.hlines(y=elly_zone_df[plot_dict[stat_id]["x_value"]].sum()/elly_zone_df[divisor_x].sum(),xmin=swing_min,xmax=len(elly_zone_df),color=colour_palette[0],linestyle='--',label=label_2)
307
 
 
308
  sns.lineplot(x=range(1,len(elly_zone_df)+1),y=elly_zone_df[plot_dict[stat_id]["x_value"]].fillna(0).rolling(window=swing_min).sum()/swing_min,color=colour_palette[0],linewidth=3,ax=ax)
309
 
310
 
 
316
  ax.hlines(y=elly_zone_df[plot_dict[stat_id]["x_value"]].fillna(0).quantile(0.9),xmin=swing_min,xmax=len(elly_zone_df),color=colour_palette[0],linestyle='--',label=label_2)
317
 
318
 
319
+
320
  sns.lineplot(x=range(1,len(elly_zone_df)+1),y=elly_zone_df[plot_dict[stat_id]["x_value"]].fillna(0).rolling(window=swing_min).quantile(0.9),color=colour_palette[0],linewidth=3,ax=ax)
321
 
322