Py.Cafe

Coding-with-Adam/

london-analysis

Average Class Size Analysis in NYC Boroughs

DocsPricing
  • Class_Size_Report_mini.csv
  • app.py
  • requirements.txt
app.py
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
# check out Dash docs - https://dash.plotly.com/
# Plotly graphs - https://plotly.com/python/
from dash import Dash, Input, Output, callback, dcc, html
import dash_ag_grid as dag
import plotly.express as px
import pandas as pd

df = pd.read_csv("https://raw.githubusercontent.com/plotly/tutorial-code/refs/heads/main/Datasets/laq-merged-30.csv")

fig = px.histogram(df, x="SiteType", y="NO2", histfunc='avg')
fig.layout.update(margin=dict(l=20, r=20, t=30, b=30))


grid = dag.AgGrid(
    rowData=df.to_dict("records"),
    columnDefs=[{"field": i, 'filter': True, 'sortable': True} for i in df.columns],
    dashGridOptions={"pagination": True},
)
app = Dash(__name__)
app.layout = html.Div(
    children=[
        dcc.Graph(figure=fig),
        grid
    ]
)


# if __name__ == "__main__":
#     app.run(debug=True)