Soundaryasos commited on
Commit
212a4d5
·
verified ·
1 Parent(s): e1ffe51

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
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 (fixed version)
95
  st.subheader("Sentiment Heatmap (Past 14 Days)")
96
  df['Day'] = df['Date'].dt.dayofweek # Monday=0, Sunday=6
97
- heatmap_data = df.groupby('Day', as_index=False).agg({'Sentiment Score': 'mean'})
98
- heatmap_data = heatmap_data.pivot(index='Day', values='Sentiment Score')
99
  fig5 = px.imshow(
100
  heatmap_data,
101
  title="Heatmap of Sentiment Over Time",
102
- labels={'x': 'Day of Week', 'y': 'Sentiment Score'},
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)