from dash import Dash, html, dcc
import plotly.express as px
import pandas as pd

app = Dash(__name__)
server = app.server

# assume you have a "long-form" data frame
# see https://plotly.com/python/px-arguments/ for more options
df = pd.DataFrame({
    "Fruit": ["Apples", "Oranges", "Bananas", "Apples", "Oranges", "Bananas"],
    "Amount": [4, 1, 2, 2, 4, 5],
    "City": ["SF", "SF", "SF", "Montreal", "Montreal", "Montreal"]
})

fig = px.bar(df, x="Fruit", y="Amount", color="City", barmode="group")

app.layout = html.Div(children=[
    html.H1(children='Hello Dash'),

    html.Div(children='''
        Dash: A web application framework for your data.
    '''),

    dcc.Graph(
        id='example-graph',
        figure=fig
    )
])

if __name__ == '__main__':
    app.run_server(debug=True)
[((88, 102), 'dash.Dash', 'Dash', (['__name__'], {}), '(__name__)\n', (92, 102), False, 'from dash import Dash, html, dcc\n'), ((235, 426), 'pandas.DataFrame', 'pd.DataFrame', (["{'Fruit': ['Apples', 'Oranges', 'Bananas', 'Apples', 'Oranges', 'Bananas'],\n    'Amount': [4, 1, 2, 2, 4, 5], 'City': ['SF', 'SF', 'SF', 'Montreal',\n    'Montreal', 'Montreal']}"], {}), "({'Fruit': ['Apples', 'Oranges', 'Bananas', 'Apples', 'Oranges',\n    'Bananas'], 'Amount': [4, 1, 2, 2, 4, 5], 'City': ['SF', 'SF', 'SF',\n    'Montreal', 'Montreal', 'Montreal']})\n", (247, 426), True, 'import pandas as pd\n'), ((440, 504), 'plotly.express.bar', 'px.bar', (['df'], {'x': '"""Fruit"""', 'y': '"""Amount"""', 'color': '"""City"""', 'barmode': '"""group"""'}), "(df, x='Fruit', y='Amount', color='City', barmode='group')\n", (446, 504), True, 'import plotly.express as px\n'), ((543, 573), 'dash.html.H1', 'html.H1', ([], {'children': '"""Hello Dash"""'}), "(children='Hello Dash')\n", (550, 573), False, 'from dash import Dash, html, dcc\n'), ((580, 672), 'dash.html.Div', 'html.Div', ([], {'children': '"""\n        Dash: A web application framework for your data.\n    """'}), '(children=\n    """\n        Dash: A web application framework for your data.\n    """)\n', (588, 672), False, 'from dash import Dash, html, dcc\n'), ((674, 715), 'dash.dcc.Graph', 'dcc.Graph', ([], {'id': '"""example-graph"""', 'figure': 'fig'}), "(id='example-graph', figure=fig)\n", (683, 715), False, 'from dash import Dash, html, dcc\n')]