Spaces:
Sleeping
Sleeping
Commit
·
1bfcc12
1
Parent(s):
01bbb5b
feat: updated website
Browse files
app.py
CHANGED
@@ -2,6 +2,7 @@ import streamlit as st
|
|
2 |
import time
|
3 |
import pandas as pd
|
4 |
import plotly.express as px
|
|
|
5 |
import matplotlib.pyplot as plt
|
6 |
import numpy as np
|
7 |
import lightgbm as lgb
|
@@ -452,31 +453,32 @@ elif page == "Customer Analysis":
|
|
452 |
# Add 2024 to the years list
|
453 |
years.append('2024')
|
454 |
|
455 |
-
|
456 |
-
|
|
|
457 |
x=years,
|
458 |
-
y=
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
463 |
|
464 |
-
# Update
|
465 |
fig_sales_bar.update_layout(
|
466 |
-
|
467 |
xaxis_title="Year",
|
468 |
-
|
|
|
469 |
height=600,
|
470 |
-
legend_title_text="Sales Type"
|
471 |
-
|
472 |
-
|
473 |
-
# Add traces for actual and predicted sales
|
474 |
-
fig_sales_bar.add_trace(
|
475 |
-
px.bar(x=years, y=sales_values, name="Actual Sales", marker_color='blue').data[0]
|
476 |
-
)
|
477 |
-
|
478 |
-
fig_sales_bar.add_trace(
|
479 |
-
px.bar(x=years, y=predicted_values, name="Predicted Sales (Annualized for 2024)", marker_color='orange').data[0]
|
480 |
)
|
481 |
|
482 |
# Show the interactive bar chart in Streamlit
|
|
|
2 |
import time
|
3 |
import pandas as pd
|
4 |
import plotly.express as px
|
5 |
+
import plotly.graph_objects as go
|
6 |
import matplotlib.pyplot as plt
|
7 |
import numpy as np
|
8 |
import lightgbm as lgb
|
|
|
453 |
# Add 2024 to the years list
|
454 |
years.append('2024')
|
455 |
|
456 |
+
fig_sales_bar = go.Figure()
|
457 |
+
# Add trace for actual sales
|
458 |
+
fig_sales_bar.add_trace(go.Bar(
|
459 |
x=years,
|
460 |
+
y=sales_values,
|
461 |
+
name="Actual Sales",
|
462 |
+
marker_color='blue'
|
463 |
+
))
|
464 |
+
|
465 |
+
# Add trace for predicted sales
|
466 |
+
fig_sales_bar.add_trace(go.Bar(
|
467 |
+
x=years,
|
468 |
+
y=predicted_values,
|
469 |
+
name="Predicted Sales (Annualized for 2024)",
|
470 |
+
marker_color='orange'
|
471 |
+
))
|
472 |
|
473 |
+
# Update layout
|
474 |
fig_sales_bar.update_layout(
|
475 |
+
title=f"Sales Over the Years for Customer {customer_code} (Actual vs Predicted)",
|
476 |
xaxis_title="Year",
|
477 |
+
yaxis_title="Sales (€)",
|
478 |
+
barmode='group',
|
479 |
height=600,
|
480 |
+
legend_title_text="Sales Type",
|
481 |
+
hovermode="x unified"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
482 |
)
|
483 |
|
484 |
# Show the interactive bar chart in Streamlit
|