title | subtitle | lang | author | date | |
---|---|---|---|---|---|
Dash |
reactive dashboards in Python |
eng |
|
December 5th 2017, Haute École Arc Ingénierie,<br/>St-Imier |
- What is Dash?
- Use cases
- Friendly projects
- Examples
- Alternatives
- Advantages and disadvantages
- Questions
"Dash is a Python framework for building analytical web applications. No JavaScript required."
-- Dash website --
This library is based on:
- Plotly: Plot data in numerous ways
- Flask: make plots accessible through a web application
- React: make dashboards reactive and update automatically when you change data filter parameters
- Monitor or examine data for datascience purpose
- Build customized business intelligence web applications
- Pandas: data loading and filtering
.csv
files and database support- {
inner
,left
,right
}join
on your data - Plots accept
pandas
DataFrame
as input data by default
- pandas: DataFrames
<iframe src="https://plot.ly/dash/gallery/live-wind-data/" style="height: 640px; width: 100%; border: 0; overflow: hidden;"> </iframe>
- Business process mining
- Tons of messy data
- Explore data to understand the process
- Machine learning once the process is undestood
- csv files with millions of lines
- Joins made with pandas
- Created new and «easier to use» csv files
- New csv files loaded by the Web application and used in the dashboards
- Other libaries exist but without interactivity.
- Ready to use softwares might do the job when you don't need custom plots.
- Open source project: https://github.com/plotly/dash
- Plots are reactive and fast (WebGL!)
- Few tweaks are necessary to make plots look nice
- Possibility to add JavaScript and CSS files
- Based on cutting edge web technologies
- All the data processing stuff can be done in Python
- Open source: pretty fast development
- Tweaks: default CSS is not that bad
- Process everything in Python --> avoid JavaScript suprises
- Example: I used materialize in a project
- Generate the HTML using Dash HTML components and Dash Core Components.
- Dash is new. Is it mature enough?
Launch these commands from a terminal to install the Python packages:
pip install dash==0.19.0 # The core dash backend
pip install dash-renderer==0.11.1 # The dash front-end
pip install dash-html-components==0.8.0 # HTML components
pip install dash-core-components==0.14.0 # Supercharged components
pip install plotly --upgrade # Latest Plotly graphing library
Create a file named app.py
:
import dash
import dash_core_components as dcc
import dash_html_components as html
app = dash.Dash()
app.layout = html.Div(children=[
html.H1(children='Hello Dash'),
html.Div(children='''
Dash: A web application framework for Python.
'''),
dcc.Graph(
id='example-graph',
figure={
'data': [
{'x': [1, 2, 3], 'y': [4, 1, 2], 'type': 'bar', 'name': 'SF'},
{'x': [1, 2, 3], 'y': [2, 4, 5], 'type': 'bar', 'name': u'Montréal'},
],
'layout': {
'title': 'Dash Data Visualization'
}
}
)
])
if __name__ == '__main__':
app.run_server(debug=True)
Run the app with the following command:
python app.py