Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -91,15 +91,15 @@ st.subheader("Sentiment Score Distribution (Past 14 Days)")
|
|
| 91 |
fig4 = px.histogram(df, x='Sentiment Score', nbins=20, title="Sentiment Score Distribution")
|
| 92 |
st.plotly_chart(fig4)
|
| 93 |
|
| 94 |
-
# Sentiment heatmap (
|
| 95 |
st.subheader("Sentiment Heatmap (Past 14 Days)")
|
| 96 |
df['Day'] = df['Date'].dt.dayofweek # Monday=0, Sunday=6
|
| 97 |
-
|
| 98 |
-
heatmap_data =
|
| 99 |
fig5 = px.imshow(
|
| 100 |
heatmap_data,
|
| 101 |
title="Heatmap of Sentiment Over Time",
|
| 102 |
-
labels={'x': '
|
| 103 |
color_continuous_scale='RdBu'
|
| 104 |
)
|
| 105 |
st.plotly_chart(fig5)
|
|
|
|
| 91 |
fig4 = px.histogram(df, x='Sentiment Score', nbins=20, title="Sentiment Score Distribution")
|
| 92 |
st.plotly_chart(fig4)
|
| 93 |
|
| 94 |
+
# Sentiment heatmap (corrected version)
|
| 95 |
st.subheader("Sentiment Heatmap (Past 14 Days)")
|
| 96 |
df['Day'] = df['Date'].dt.dayofweek # Monday=0, Sunday=6
|
| 97 |
+
df['Hour'] = np.random.randint(0, 24, len(df)) # Simulating hourly data
|
| 98 |
+
heatmap_data = df.pivot(index='Day', columns='Hour', values='Sentiment Score')
|
| 99 |
fig5 = px.imshow(
|
| 100 |
heatmap_data,
|
| 101 |
title="Heatmap of Sentiment Over Time",
|
| 102 |
+
labels={'x': 'Hour of Day', 'y': 'Day of Week'},
|
| 103 |
color_continuous_scale='RdBu'
|
| 104 |
)
|
| 105 |
st.plotly_chart(fig5)
|