forked from vagabond-systems/quantium-starter-repo
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDataVisualisation1.py
More file actions
41 lines (32 loc) · 890 Bytes
/
DataVisualisation1.py
File metadata and controls
41 lines (32 loc) · 890 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import dash
from dash import dcc, html
import pandas as pd
import plotly.express as px
# Load the processed data
DATA_PATH = "./formatted_data.csv"
df = pd.read_csv(DATA_PATH)
print(df.head())
print(df.columns)
# Convert date column to datetime for proper sorting (day first)
df["date"] = pd.to_datetime(df["date"], dayfirst=True)
df = df.sort_values("date")
# Create the line chart
fig = px.line(
df,
x="date",
y="sales",
color="region", # optional, shows different lines per region
title="Sales Over Time",
labels={"date": "Transaction Date", "sales": "Sales ($)"}
)
# Initialize the Dash app
app = dash.Dash(__name__)
app.layout = html.Div(children=[
html.H1("Pink Morsel Sales Visualiser", style={"textAlign": "center"}),
dcc.Graph(
id="sales-line-chart",
figure=fig
)
])
if __name__ == "__main__":
app.run(debug=True)