Spaces:
Sleeping
Sleeping
Update charts.py
Browse files
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({"
|
| 457 |
df["text_short"] = df["text"].str[:80] + "…"
|
| 458 |
|
| 459 |
fig = go.Figure()
|
| 460 |
-
for lbl, clr in [("
|
| 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
|