From 350464164349e3f084e7510ccd06bad5ad603013 Mon Sep 17 00:00:00 2001 From: Jake Pullen Date: Sat, 10 Aug 2024 21:47:08 +0100 Subject: [PATCH] understanding dash --- dash_app.py | 22 ++++++++++++++++++++++ requirements.txt | 3 ++- 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 dash_app.py diff --git a/dash_app.py b/dash_app.py new file mode 100644 index 0000000..d08736d --- /dev/null +++ b/dash_app.py @@ -0,0 +1,22 @@ +# Import packages +from dash import Dash, html, dash_table +import polars as pd + +# Incorporate data +df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/gapminder2007.csv') + +# Convert DataFrame to list of dictionaries +data = df.to_pandas().to_dict('records') + +# Initialize the app +app = Dash() + +# App layout +app.layout = [ + html.Div(children='My First App with Data'), + dash_table.DataTable(data=data) +] + +# Run the app +if __name__ == '__main__': + app.run(debug=True) \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 5950c70..d7b59fe 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,5 @@ python-dotenv polars requests -pyyaml \ No newline at end of file +pyyaml +dash \ No newline at end of file