rocky250 commited on
Commit
f0cf309
·
verified ·
1 Parent(s): 8351494

Update charts.py

Browse files
Files changed (1) hide show
  1. charts.py +2 -2
charts.py CHANGED
@@ -453,11 +453,11 @@ def sentiment_timeline(comments_df: pd.DataFrame, sentiments: List[Dict]) -> go.
453
  df = comments_df.copy()
454
  df["compound"] = [s.get("compound", 0) for s in sentiments]
455
  df["label"] = [s.get("label", "NEUTRAL") for s in sentiments]
456
- df["color"] = df["label"].map({"POSITIVELY ENGAGEMENT": GREEN, "NEGATIVELY ENGAGEMENT": RED, "NEUTRAL": AMBER})
457
  df["text_short"] = df["text"].str[:80] + "…"
458
 
459
  fig = go.Figure()
460
- for lbl, clr in [("POSITIVELY ENGAGEMENT", GREEN), ("NEGATIVELY ENGAGEMENT", RED), ("NEUTRAL", AMBER)]:
461
  sub = df[df["label"] == lbl]
462
  if sub.empty:
463
  continue
 
453
  df = comments_df.copy()
454
  df["compound"] = [s.get("compound", 0) for s in sentiments]
455
  df["label"] = [s.get("label", "NEUTRAL") for s in sentiments]
456
+ df["color"] = df["label"].map({"POSITIVE": GREEN, "NEGATIVE": RED, "NEUTRAL": AMBER})
457
  df["text_short"] = df["text"].str[:80] + "…"
458
 
459
  fig = go.Figure()
460
+ for lbl, clr in [("POSITIVE", GREEN), ("NEGATIVE", RED), ("NEUTRAL", AMBER)]:
461
  sub = df[df["label"] == lbl]
462
  if sub.empty:
463
  continue