KEMBAR78
Plotly dash and data visualisation in Python | PDF
Volodymyrk
1
Berlin, 16th July, 2017
And Data Visualisation in Python
Volodymyrk
Volodymyr ( Vlad ) Kazantsev
Head of Data Science @ Wooga
Head of Data @ Product Madness
Product Manager
MBA @LBS
Graphics programming
Writes code for money since 2002
Math degree
2
Live Demo-1
Volodymyrk
Plotly dash .. 2 minute version
- Build interactive data visualisations for the Web
- In Pure Python - no HTML/JavaScipt required
5
Volodymyrk
What is Plotly (visualisation library)?
6
+ +
API bindings:
- Core is 100% Open Source
- Has enterprise plans (and premium plugins)
- 50%+ of all devs are working on Open Source code
Volodymyrk
Data Visualisation Libraries in Python
1986 - GNU Plot
2003 - Matplotlib (14 years ago!)
2012 - Bokeh
2012 - Seaborn
2014 - Plotly.py
June 2017 - Dash
7
Volodymyrk
What are we trying to solve?
Master Dashboard
- External or internal clients
- Lot’s of interactivity
- Complex Layout
8
Analytics Portal
- Lots of Dashboards
- Many are similar
- Interactive filters/selectors
Report Generator
- Produces HTML report
- Based on inputs
Interactivity/ Exploration Pre-made choices
Volodymyrk
Option-1: Tableau
● Also Looker, Periscope, Superset, Qlick, Mode, Redash..
● If existing functionality is enough
● If you don’t need to automate the creation
● If “creator and owner” of those dashboards is a Business Data Analyst (e.g. not code-savvy
data scientist)
9
Volodymyrk
Option-2: R-Shiny
+ Mature
+ Backed by RStudio (commercial company)
+ Looks good
- R
10
Volodymyrk
Option-3: Python back-end, JavaScript front-end
+ No middleman between browser code and you
+ Mature ecosystem
- Too complex for a regular Data Scientist
11
Web Framework: Flask, Django, Tornado, etc.
Data Layer: Numpy, Pandas, Scipy, etc
HTML+JS: D3.js, NVD3, HighCharts, Plotly etc.
Volodymyrk
Option-4: Bokeh Server
● Best-kept secret in Python Data Ecosystem
● Custom JavaScript library (Bokeh.js)
● Uses HTML Canvas (or WebGL)
● Historically used CoffeeScript
12
Volodymyrk
Bokeh Server
Bokeh.js:
- Html Canvas, lots of custom JS code
Bokeh Widgets:
- Lots of custom code
- Hard to style
Bokeh Server:
- Based on Tornado
- Stateful
13
Plotly Dashvs.
Plotly.js
- Based on D3.js
Dash Components:
- All normal HTML components in Dash
- Build on top of React!
Plotly Server:
- Just Flask
- Stateless
Volodymyrk
Bokeh Server
Bokeh.js:
- Html Canvas, lots of custom JS code
Bokeh Widgets:
- Lots of custom code
- Hard to style
Bokeh Server:
- Based on Tornado
- Stateful
14
Plotly Dashvs.
Plotly.js
- Based on D3.js
Dash Components:
- All normal HTML components in Dash
- Build on top of React!
Plotly Server:
- Just Flask
- Stateless
Volodymyrk
Option-6: Jupyter Dashboards
+ Easy to build
- Layouts/callbacks/interactivity is limited
- Not suitable for building “client-facing” apps
15
Volodymyrk
FrontEnd:
D3,
Plotly.js
Highchart
BackEnd:
Python, Java
In summary
16
Exploration Product For SalePrototype/Quick App
Jupyter Notebook
(Local) Tableau
Excel
Jupyter Dashboard
Internal Data Product
Tableau Server
RShiny
Bokeh Server
Plotly Dash
Live Demo-2
Volodymyrk
Case Study
You just get the best job in the galaxy
Volodymyrk
19
Your new Boss Business domain Business case
I love synthetic data
Volodymyrk
20
Class-1 Class-2
Class-3 Class-5
http://starwars.wikia.com/wiki/Droid
Volodymyrk
Jabba’s Used Droid business
21
Multi Dimensional Event-level Time Series
Volodymyrk
22
Tips and Tricks
Volodymyrk
Tip-1: truly data-driven apps
- Dynamic, data-driven, layout
Def build_layout(..):
app.layout = build_layout
24
- Need to pre-define all callbacks
app.config.supress_callback_exceptions = True
Volodymyrk
Tip-2: Caching
- App is Stateless!
25
Volodymyrk
Tip-3: Production Deployment
dash-project/
app1/
app.py
datamodel.py
app2/
app.py
datamodel.py
mycomponents/
...
server.py
Run.py
uwsgi .. --wsgi-file run.py
https://community.plot.ly/t/multiple-dashboards/4656
26
Monolithic App UWSGI Emperor Mode
Similar structure, but we are
not there yet..
Volodymyrk
Tip 4: Where to get help?
Don’t use StackOverflow yet.. however there is a #plotly-dash tag already
Official forum:
https://community.plot.ly/c/dash
27
● Data Scientist
● Senior Data Scientist
● Data Engineer
● Data Engineer (intern/student)
● Game Design, Art, UX
● Product Marketer
● Game devs (Unity and iOS)
● Product Manager, Live Operations
● Senior Product Manager (x3)
● And many more! . . . check out jobs.wooga.com
is HIRING!
jobs.wooga.com
Volodymyrk
Appendix
29
Product Analytics Data Science Data Engineering
Analytics is not a team, but describes the way
Wooga approaches decisions
Dashboards
AB Tests
Game Balancing
Ad-hoc Insights
Business reviews Deep-dive Analysis
Machine Learning
Data Processing: Airflow
Data Pipeline: Kafka, Exasol
Data Access: Periscope, Jupyter
In-house Tools
Infrastructure: kubernetes
Stats ModellingBusiness modelling
Our Tech Stack
Airflow
Magic 8 Ball Predictive
Analytics
Research
Dashboards
& Data Viz.

Plotly dash and data visualisation in Python