nesticot commited on
Commit
785d83c
·
verified ·
1 Parent(s): 4cfc4c8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -1
app.py CHANGED
@@ -61,13 +61,30 @@ def df_final(df:pl.dataframe,year_input:int,sport_id:int):
61
 
62
 
63
  print('schedule')
64
-
 
 
 
 
 
 
 
 
 
 
 
 
 
65
  df_stuff = stuff_apply.stuff_apply(fe.feature_engineering(df))
66
  print('stuff')
67
  df_up = update.update(df)
68
  print('update')
69
  df_total = df_up.join(df_stuff[['play_id','tj_stuff_plus']], on='play_id', how='left')
70
  print('total')
 
 
 
 
71
  return df_total
72
 
73
 
 
61
 
62
 
63
  print('schedule')
64
+ # Calculate mound_to_release as 60.5 - extension
65
+ df = df.with_columns([
66
+ (60.5 - df["extension"]).alias("release_pos_y")
67
+ ])
68
+
69
+ # Calculate delta time (Δt)
70
+ delta_t = (df["release_pos_y"] - df["y0"]) / df["vy0"]
71
+
72
+ # Corrected back-calculation of release_pos_x and release_pos_z
73
+ df = df.with_columns([
74
+ (df["x0"] + df["vx0"] * delta_t + 0.5 * df["ax"] * delta_t ** 2).alias("release_pos_x"),
75
+ (df["z0"] + df["vz0"] * delta_t + 0.5 * df["az"] * delta_t ** 2).alias("release_pos_z")
76
+ ])
77
+
78
  df_stuff = stuff_apply.stuff_apply(fe.feature_engineering(df))
79
  print('stuff')
80
  df_up = update.update(df)
81
  print('update')
82
  df_total = df_up.join(df_stuff[['play_id','tj_stuff_plus']], on='play_id', how='left')
83
  print('total')
84
+
85
+
86
+
87
+
88
  return df_total
89
 
90