| name | dash-1-basic-application-structure |
| description | Sub-skill of dash: 1. Basic Application Structure. |
| version | 1.0.0 |
| category | data-analysis |
| type | reference |
| scripts_exempt | true |
1. Basic Application Structure
1. Basic Application Structure
Minimal Dash App:
from dash import Dash, html, dcc
import plotly.express as px
import pandas as pd
app = Dash(__name__)
df = pd.DataFrame({
"Fruit": ["Apples", "Oranges", "Bananas", "Apples", "Oranges", "Bananas"],
"Amount": [4, 1, 2, 2, 4, 5],
"City": ["SF", "SF", "SF", "NYC", "NYC", "NYC"]
})
fig = px.bar(df, x="Fruit", y="Amount", color="City", barmode="group")
app.layout = html.Div([
html.H1("Hello Dash"),
html.P("This is a simple Dash application."),
dcc.Graph(id="example-graph", figure=fig)
])
if __name__ == "__main__":
app.run(debug=True)
Run the app:
python app.py