nesticot commited on
Commit
7694b68
·
verified ·
1 Parent(s): 1e9f45f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -398,7 +398,7 @@ def server(input, output, session):
398
  @reactive.event(input.refresh)
399
  def table_all():
400
 
401
- df_spring = spring_data()
402
 
403
  # df_year_old = stuff_apply.stuff_apply(fe.feature_engineering(pl.concat([df_mlb,df_aaa,df_a,df_afl])))
404
  # df_year_2old = stuff_apply.stuff_apply(fe.feature_engineering(pl.concat([df_mlb_2023])))
@@ -608,7 +608,7 @@ def server(input, output, session):
608
  @reactive.event(input.refresh)
609
  def table_daily():
610
 
611
- df_spring = spring_data()
612
 
613
  # df_year_old = stuff_apply.stuff_apply(fe.feature_engineering(pl.concat([df_mlb,df_aaa,df_a,df_afl])))
614
  # df_year_2old = stuff_apply.stuff_apply(fe.feature_engineering(pl.concat([df_mlb_2023])))
@@ -619,13 +619,13 @@ def server(input, output, session):
619
  import polars as pl
620
 
621
  # Compute total pitches for each pitcher
622
- df_pitcher_totals = df_spring_stuff.group_by(["pitcher_id",'game_date']).agg(
623
  pl.col("start_speed").count().alias("pitcher_total")
624
  )
625
 
626
  df_pitcher_totals_hands = (
627
  df_spring_stuff
628
- .group_by(["pitcher_id", "batter_hand",'game_date'])
629
  .agg(pl.col("start_speed").count().alias("pitcher_total"))
630
  .pivot(
631
  values="pitcher_total",
@@ -638,7 +638,7 @@ def server(input, output, session):
638
  )
639
 
640
 
641
- df_spring_group = df_spring_stuff.group_by(['pitcher_id', 'pitcher_name', 'pitch_type','game_date']).agg([
642
  pl.col('start_speed').count().alias('count'),
643
  pl.col('start_speed').mean().alias('start_speed'),
644
  pl.col('start_speed').max().alias('max_start_speed'),
 
398
  @reactive.event(input.refresh)
399
  def table_all():
400
 
401
+ df_spring = spring_data().unique(subset=['play_id'])
402
 
403
  # df_year_old = stuff_apply.stuff_apply(fe.feature_engineering(pl.concat([df_mlb,df_aaa,df_a,df_afl])))
404
  # df_year_2old = stuff_apply.stuff_apply(fe.feature_engineering(pl.concat([df_mlb_2023])))
 
608
  @reactive.event(input.refresh)
609
  def table_daily():
610
 
611
+ df_spring = spring_data().unique(subset=['play_id'])
612
 
613
  # df_year_old = stuff_apply.stuff_apply(fe.feature_engineering(pl.concat([df_mlb,df_aaa,df_a,df_afl])))
614
  # df_year_2old = stuff_apply.stuff_apply(fe.feature_engineering(pl.concat([df_mlb_2023])))
 
619
  import polars as pl
620
 
621
  # Compute total pitches for each pitcher
622
+ df_pitcher_totals = df_spring_stuff.group_by(["pitcher_id",'game_id','game_date']).agg(
623
  pl.col("start_speed").count().alias("pitcher_total")
624
  )
625
 
626
  df_pitcher_totals_hands = (
627
  df_spring_stuff
628
+ .group_by(["pitcher_id", "batter_hand",'game_id','game_date'])
629
  .agg(pl.col("start_speed").count().alias("pitcher_total"))
630
  .pivot(
631
  values="pitcher_total",
 
638
  )
639
 
640
 
641
+ df_spring_group = df_spring_stuff.group_by(['pitcher_id', 'pitcher_name', 'pitch_type','game_id','game_date']).agg([
642
  pl.col('start_speed').count().alias('count'),
643
  pl.col('start_speed').mean().alias('start_speed'),
644
  pl.col('start_speed').max().alias('max_start_speed'),