nesticot commited on
Commit
be6b33b
1 Parent(s): f2c2f23

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -1
app.py CHANGED
@@ -331,6 +331,16 @@ def server(input,output,session):
331
 
332
 
333
  traj_trajectory_df= df_batter_2023.groupby(['traj','trajectory'])['launch_speed'].count() / len(df_batter_2023)
 
 
 
 
 
 
 
 
 
 
334
  traj_dict = { 'Pull':30,
335
  'Straight':0,
336
  'Oppo':-30}
@@ -349,7 +359,7 @@ def server(input,output,session):
349
  else:
350
  ax11.text(s=f"{traj_trajectory_df.loc[i,j]:.1%}",
351
  x=traj_dict[i],
352
- y=traj_trajectory_dict[j],va='center',ha='center',fontsize=12,alpha=0.7)
353
 
354
 
355
  app = App(ui.page_fluid(
 
331
 
332
 
333
  traj_trajectory_df= df_batter_2023.groupby(['traj','trajectory'])['launch_speed'].count() / len(df_batter_2023)
334
+
335
+
336
+ # Define the four indices you want
337
+ desired_traj = ['Pull', 'Straight', 'Oppo']
338
+ trajectory = ['fly_ball', 'ground_ball', 'line_drive', 'popup']
339
+ # Create a MultiIndex from the desired indices
340
+ multi_index = pd.MultiIndex.from_product([desired_traj,trajectory], names=['traj','trajectory'])
341
+ traj_trajectory_df = traj_trajectory_df.reindex(multi_index, fill_value=0)
342
+
343
+
344
  traj_dict = { 'Pull':30,
345
  'Straight':0,
346
  'Oppo':-30}
 
359
  else:
360
  ax11.text(s=f"{traj_trajectory_df.loc[i,j]:.1%}",
361
  x=traj_dict[i],
362
+ y=traj_trajectory_dict[j],va='center',ha='center',fontsize=12,alpha=0.7)
363
 
364
 
365
  app = App(ui.page_fluid(