Update app.py
Browse files
app.py
CHANGED
@@ -130,22 +130,22 @@ def server(input, output, session):
|
|
130 |
def spring_data():
|
131 |
|
132 |
import polars as pl
|
133 |
-
df_spring = pl.read_parquet(f"hf://datasets/TJStatsApps/mlb_data/data/
|
134 |
|
135 |
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
#
|
140 |
|
141 |
|
142 |
-
|
143 |
-
|
144 |
|
145 |
-
|
146 |
-
|
147 |
|
148 |
-
|
149 |
|
150 |
return df_spring.filter(pl.col('start_speed')>0)
|
151 |
|
|
|
130 |
def spring_data():
|
131 |
|
132 |
import polars as pl
|
133 |
+
df_spring = pl.read_parquet(f"hf://datasets/TJStatsApps/mlb_data/data/mlb_pitch_data_2025.parquet")
|
134 |
|
135 |
|
136 |
+
date = (datetime.datetime.now() - datetime.timedelta(hours=8)).date()
|
137 |
+
print(datetime.datetime.now())
|
138 |
+
date_str = date.strftime('%Y-%m-%d')
|
139 |
+
# Initialize the scraper
|
140 |
|
141 |
|
142 |
+
game_list_input = (scraper.get_schedule(year_input=[int(date_str[0:4])], sport_id=[1], game_type=['R'])
|
143 |
+
.filter(pl.col('date') == date)['game_id'])
|
144 |
|
145 |
+
data = scraper.get_data(game_list_input)
|
146 |
+
df = scraper.get_data_df(data)
|
147 |
|
148 |
+
df_spring = pl.concat([df_spring, df]).sort('game_date', descending=True)
|
149 |
|
150 |
return df_spring.filter(pl.col('start_speed')>0)
|
151 |
|