Jay-Rajput commited on
Commit
b20d33a
·
1 Parent(s): a43989d

updating show preds

Browse files
Files changed (1) hide show
  1. app.py +9 -8
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
- predictions_df['prediction_date'] = predictions_df.apply(lambda x: datetime.strptime(x['prediction_date'], '%Y-%m-%d'), axis=1)
 
239
 
240
- # Filter for today's predictions
241
- today_str = datetime.now().strftime('%Y-%m-%d')
242
- todays_predictions = predictions_df[predictions_df['prediction_date'] == today_str]
243
 
244
- # Remove the 'prediction_id' column if it exists
245
- if 'prediction_id' in todays_predictions.columns:
246
- todays_predictions = todays_predictions.drop(columns=['prediction_id', 'prediction_date'])
247
 
248
- if not todays_predictions.empty:
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.")