arif670 commited on
Commit
e9d0bfd
Β·
verified Β·
1 Parent(s): e66172d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -7
app.py CHANGED
@@ -464,6 +464,9 @@ def main():
464
  if 'recurrence' not in df.columns:
465
  df['recurrence'] = [{} for _ in range(len(df))]
466
 
 
 
 
467
  # Filters
468
  col1, col2, col3 = st.columns(3)
469
  with col1:
@@ -517,17 +520,18 @@ def main():
517
  """, unsafe_allow_html=True)
518
 
519
  # Recurrence Details
520
- if row['recurrence'].get('type') != "None":
 
521
  with st.expander("πŸ” Recurrence Details"):
522
- st.write(f"**Type:** {row['recurrence']['type']}")
523
- st.write(f"**Start Date:** {row['recurrence']['original_date']}")
524
- if row['recurrence'].get('end_date'):
525
- st.write(f"**End Date:** {row['recurrence']['end_date']}")
526
  else:
527
- st.write(f"**Occurrences:** {row['recurrence']['num_occurrences']}")
528
 
529
  # Attachments
530
- attachments = row['attachments']
531
  if attachments:
532
  with st.expander(f"πŸ“Ž Attachments ({len(attachments)})"):
533
  for att in attachments:
 
464
  if 'recurrence' not in df.columns:
465
  df['recurrence'] = [{} for _ in range(len(df))]
466
 
467
+ # Convert NaN values to empty dictionaries
468
+ df['recurrence'] = df['recurrence'].apply(lambda x: x if isinstance(x, dict) else {})
469
+
470
  # Filters
471
  col1, col2, col3 = st.columns(3)
472
  with col1:
 
520
  """, unsafe_allow_html=True)
521
 
522
  # Recurrence Details
523
+ recurrence = row.get('recurrence', {}) # Safely get recurrence
524
+ if recurrence.get('type') != "None":
525
  with st.expander("πŸ” Recurrence Details"):
526
+ st.write(f"**Type:** {recurrence['type']}")
527
+ st.write(f"**Start Date:** {recurrence['original_date']}")
528
+ if recurrence.get('end_date'):
529
+ st.write(f"**End Date:** {recurrence['end_date']}")
530
  else:
531
+ st.write(f"**Occurrences:** {recurrence.get('num_occurrences', 'N/A')}")
532
 
533
  # Attachments
534
+ attachments = row.get('attachments', []) # Safely get attachments
535
  if attachments:
536
  with st.expander(f"πŸ“Ž Attachments ({len(attachments)})"):
537
  for att in attachments: