Skip to content

Instantly share code, notes, and snippets.

@gabriead
Last active November 27, 2020 08:33
Show Gist options
  • Save gabriead/4d43a2bd3b0bdbaaee0996656c840369 to your computer and use it in GitHub Desktop.
Save gabriead/4d43a2bd3b0bdbaaee0996656c840369 to your computer and use it in GitHub Desktop.
DashPlotly.ipynb
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"metadata": {
"trusted": true
},
"cell_type": "code",
"source": "import dash\nimport dash_html_components as html\nimport dash_table\nfrom jupyter_dash import JupyterDash\nimport pandas as pd\nfrom collections import OrderedDict\n\napp = JupyterDash(__name__)\n\ndf = pd.DataFrame(OrderedDict([\n ('Lock-offs', ['One-Arm Negatives', 'Two-Arm Rowers', 'One-Arm Locks on Rings',\n 'Frenchies','One-Arm Pull-Ups', 'Shoulder Pumps']),\n ('Reps', ['3', '4', '5', '6',\"7\",\"8\"]),\n ('Sets', ['3', '4', '5', '6',\"7\",\"8\"])\n]))\n\n\napp.layout = html.Div([\n dash_table.DataTable(\n id='table-dropdown',\n data=df.to_dict('records'),\n columns=[\n {'id': 'Lock-offs', 'name': 'Lock-offs', 'presentation': 'dropdown'},\n {'id': 'Reps', 'name': 'Reps', 'presentation': 'dropdown'},\n {'id': 'Sets', 'name': 'Sets', 'presentation': 'dropdown'},\n ],\n\n editable=True,\n dropdown={\n 'Lock-offs': {\n 'options': [\n {'label': i, 'value': i}\n for i in df['Lock-offs'].unique()\n ]\n },\n 'Reps': {\n 'options': [\n {'label': i, 'value': i}\n for i in df['Reps'].unique()\n ]\n },\n 'Sets': {\n 'options': [\n {'label': i, 'value': i}\n for i in df['Sets'].unique()\n ]\n }\n }\n ),\n html.Div(id='table-dropdown-container')\n])\n\n\napp.run_server(mode='inline')",
"execution_count": 1,
"outputs": [
{
"output_type": "display_data",
"data": {
"text/plain": "<IPython.lib.display.IFrame at 0x7f851e09d3d0>",
"text/html": "\n <iframe\n width=\"100%\"\n height=\"650\"\n src=\"http://127.0.0.1:8050/\"\n frameborder=\"0\"\n allowfullscreen\n ></iframe>\n "
},
"metadata": {}
}
]
},
{
"metadata": {
"trusted": true
},
"cell_type": "code",
"source": "",
"execution_count": null,
"outputs": []
}
],
"metadata": {
"kernelspec": {
"name": "python3",
"display_name": "Python 3",
"language": "python"
},
"language_info": {
"name": "python",
"version": "3.8.3",
"mimetype": "text/x-python",
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"pygments_lexer": "ipython3",
"nbconvert_exporter": "python",
"file_extension": ".py"
},
"gist": {
"id": "4d43a2bd3b0bdbaaee0996656c840369",
"data": {
"description": "DashPlotly.ipynb",
"public": true
}
},
"_draft": {
"nbviewer_url": "https://gist.github.com/4d43a2bd3b0bdbaaee0996656c840369"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment