Spaces:
Sleeping
Sleeping
Commit
·
b20d33a
1
Parent(s):
a43989d
updating show preds
Browse files
app.py
CHANGED
|
@@ -235,17 +235,18 @@ def display_predictions():
|
|
| 235 |
# Convert the list of dictionaries to a DataFrame
|
| 236 |
predictions_df = pd.DataFrame(all_predictions)
|
| 237 |
|
| 238 |
-
|
|
|
|
| 239 |
|
| 240 |
-
|
| 241 |
-
|
| 242 |
-
|
| 243 |
|
| 244 |
-
|
| 245 |
-
|
| 246 |
-
|
| 247 |
|
| 248 |
-
|
| 249 |
st.dataframe(todays_predictions, hide_index=True)
|
| 250 |
else:
|
| 251 |
st.write("No predictions for today's matches yet.")
|
|
|
|
| 235 |
# Convert the list of dictionaries to a DataFrame
|
| 236 |
predictions_df = pd.DataFrame(all_predictions)
|
| 237 |
|
| 238 |
+
if not predictions_df.empty:
|
| 239 |
+
predictions_df['prediction_date'] = predictions_df.apply(lambda x: datetime.strptime(x['prediction_date'], '%Y-%m-%d'), axis=1)
|
| 240 |
|
| 241 |
+
# Filter for today's predictions
|
| 242 |
+
today_str = datetime.now().strftime('%Y-%m-%d')
|
| 243 |
+
todays_predictions = predictions_df[predictions_df['prediction_date'] == today_str]
|
| 244 |
|
| 245 |
+
# Remove the 'prediction_id' column if it exists
|
| 246 |
+
if 'prediction_id' in todays_predictions.columns:
|
| 247 |
+
todays_predictions = todays_predictions.drop(columns=['prediction_id', 'prediction_date'])
|
| 248 |
|
| 249 |
+
|
| 250 |
st.dataframe(todays_predictions, hide_index=True)
|
| 251 |
else:
|
| 252 |
st.write("No predictions for today's matches yet.")
|