Update app.py
Browse files
app.py
CHANGED
@@ -39,7 +39,6 @@ categories = sorted(guest_by_channel['category'].unique().tolist())
|
|
39 |
|
40 |
# ---- DASHBOARD COMPONENTS ----
|
41 |
|
42 |
-
# 1. Executive Summary
|
43 |
def executive_summary():
|
44 |
# Calculate key metrics
|
45 |
total_guests = len(guest_by_channel)
|
@@ -62,40 +61,19 @@ def executive_summary():
|
|
62 |
specs=[[{"type": "indicator"}, {"type": "indicator"}],
|
63 |
[{"type": "pie"}, {"type": "bar"}]],
|
64 |
subplot_titles=("Total Guest Views (M)", "Avg Views per Guest (M)",
|
65 |
-
|
66 |
)
|
67 |
|
68 |
-
# Add indicators
|
69 |
fig.add_trace(
|
70 |
go.Indicator(
|
71 |
mode="number",
|
72 |
-
value=total_views /
|
73 |
number={"suffix": "M", "valueformat": ".1f"},
|
74 |
title={"text": "Total Views"}
|
75 |
),
|
76 |
row=1, col=1
|
77 |
)
|
78 |
|
79 |
-
# Create summary visualizations
|
80 |
-
fig = make_subplots(
|
81 |
-
rows=2, cols=2,
|
82 |
-
specs=[[{"type": "indicator"}, {"type": "indicator"}],
|
83 |
-
[{"type": "pie"}, {"type": "bar"}]],
|
84 |
-
subplot_titles=("Total Guest Views (M)", "Avg Views per Guest (M)",
|
85 |
-
"Guest Categories", "Guest Gender Distribution")
|
86 |
-
)
|
87 |
-
|
88 |
-
# Add indicators
|
89 |
-
fig.add_trace(
|
90 |
-
go.Indicator(
|
91 |
-
mode="number",
|
92 |
-
value=total_views / 1_000_000,
|
93 |
-
number={"suffix": "M", "valueformat": ".1f"},
|
94 |
-
title={"text": "Total Views"}
|
95 |
-
),
|
96 |
-
row=1, col=1
|
97 |
-
)
|
98 |
-
|
99 |
fig.add_trace(
|
100 |
go.Indicator(
|
101 |
mode="number",
|
@@ -106,7 +84,6 @@ fig.add_trace(
|
|
106 |
row=1, col=2
|
107 |
)
|
108 |
|
109 |
-
# Add category pie chart
|
110 |
fig.add_trace(
|
111 |
go.Pie(
|
112 |
labels=category_views.index,
|
@@ -117,11 +94,10 @@ fig.add_trace(
|
|
117 |
row=2, col=1
|
118 |
)
|
119 |
|
120 |
-
# Add bar chart (corrected part)
|
121 |
fig.add_trace(
|
122 |
go.Bar(
|
123 |
-
x=category_views.index,
|
124 |
-
y=category_views.values,
|
125 |
marker_color='indianred',
|
126 |
text=category_views.values,
|
127 |
textposition='auto',
|
@@ -129,7 +105,6 @@ fig.add_trace(
|
|
129 |
),
|
130 |
row=2, col=2
|
131 |
)
|
132 |
-
|
133 |
|
134 |
fig.update_layout(
|
135 |
height=600,
|
|
|
39 |
|
40 |
# ---- DASHBOARD COMPONENTS ----
|
41 |
|
|
|
42 |
def executive_summary():
|
43 |
# Calculate key metrics
|
44 |
total_guests = len(guest_by_channel)
|
|
|
61 |
specs=[[{"type": "indicator"}, {"type": "indicator"}],
|
62 |
[{"type": "pie"}, {"type": "bar"}]],
|
63 |
subplot_titles=("Total Guest Views (M)", "Avg Views per Guest (M)",
|
64 |
+
"Guest Categories", "Guest Gender Distribution")
|
65 |
)
|
66 |
|
|
|
67 |
fig.add_trace(
|
68 |
go.Indicator(
|
69 |
mode="number",
|
70 |
+
value=total_views / 1_000_000,
|
71 |
number={"suffix": "M", "valueformat": ".1f"},
|
72 |
title={"text": "Total Views"}
|
73 |
),
|
74 |
row=1, col=1
|
75 |
)
|
76 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
fig.add_trace(
|
78 |
go.Indicator(
|
79 |
mode="number",
|
|
|
84 |
row=1, col=2
|
85 |
)
|
86 |
|
|
|
87 |
fig.add_trace(
|
88 |
go.Pie(
|
89 |
labels=category_views.index,
|
|
|
94 |
row=2, col=1
|
95 |
)
|
96 |
|
|
|
97 |
fig.add_trace(
|
98 |
go.Bar(
|
99 |
+
x=category_views.index,
|
100 |
+
y=category_views.values,
|
101 |
marker_color='indianred',
|
102 |
text=category_views.values,
|
103 |
textposition='auto',
|
|
|
105 |
),
|
106 |
row=2, col=2
|
107 |
)
|
|
|
108 |
|
109 |
fig.update_layout(
|
110 |
height=600,
|