Update app.py
Browse files
app.py
CHANGED
|
@@ -191,10 +191,10 @@ trending_keywords = Counter(words).most_common(10)
|
|
| 191 |
logging.info("Top 10 Trending Keywords in Captions:")
|
| 192 |
print(trending_keywords)
|
| 193 |
|
| 194 |
-
# Engagement Heatmap by Time of Day
|
| 195 |
logging.info("Creating engagement heatmap by time of day...")
|
| 196 |
-
|
| 197 |
-
engagement_by_hour =
|
| 198 |
|
| 199 |
plt.figure(figsize=(10, 6))
|
| 200 |
sns.heatmap(engagement_by_hour.pivot_table(index='hour', values='engagement_rate'), annot=True, cmap='YlGnBu')
|
|
|
|
| 191 |
logging.info("Top 10 Trending Keywords in Captions:")
|
| 192 |
print(trending_keywords)
|
| 193 |
|
| 194 |
+
# Engagement Heatmap by Time of Day (using combined data)
|
| 195 |
logging.info("Creating engagement heatmap by time of day...")
|
| 196 |
+
combined_df['hour'] = combined_df['posting_time'].dt.hour
|
| 197 |
+
engagement_by_hour = combined_df.groupby('hour')['engagement_rate'].mean().reset_index()
|
| 198 |
|
| 199 |
plt.figure(figsize=(10, 6))
|
| 200 |
sns.heatmap(engagement_by_hour.pivot_table(index='hour', values='engagement_rate'), annot=True, cmap='YlGnBu')
|