SlideShare a Scribd company logo
PYTHON TO REPORT IN
ONE COMMAND
Vicky Close, Second Measure
Talk overview
• Communicating insights
• Google Apps Script
• Coffee
About me
http://blog.secondmeasure.com/2016/04/26/chipotle-recovering-from-food-safety-scare/
http://www.forbes.com/sites/gilpress/2016/03/23/data-preparation-most-time-consuming-least-enjoyable-
data-science-task-survey-says/#581e921a7f75
My motivation
ipython
notebook
for analysis
Report in
Google Doc
Dashboards
(interactive?)
Excel
spreadsheets
Python to report in one command
Existing tools for creating reports
• There are lots of options!
Coffee prices data set
■ http://www.economicswebinstitute.org/ecdata.htm
■ Prices paid to growers in exporting ICO countries for
two coffee brands (Arabica and Robusta).
■ Retail price paid by consumer to commercial
distributer in importing ICO countries.
■ US cents per lb per month between 1982 and 2001.
Python to report in one command
Python to report in one command
nbconvert
ipython nbconvert --to html ipython nbconvert --to latex
Plotly
• Online data visualisation platform.
• Written using Python, Django, JavaScript,
D3.js.
• API library for Python.
Creating a map using Plotly
Prices paid to Arabica coffee growers
HTML reports using Plotly
http://moderndata.plot.ly/generate-html-reports-with-python-pandas-and-plotly/
Jinja2
• Template engine for Python.
http://jinja.pocoo.org/
http://pbpython.com/pdf-reports.html
Python to report in one command
Python to report in one command
Python to report in one command
Python to report in one command
Python to report in one command
ipython
notebook
Report
(html, pdf, …)
But…
• Not easy for other’s to add comments and
edits.
Google Drive API
• One of many Google APIs
• Has a python client library
• Upload and download files
• Convert files
https://developers.google.com/drive/v3/web/quickstart/python#prerequisites
Workflow
ipython
notebook
html
Google
Doc
ipython nbconvert
--to html
Google Drive API
Python to report in one command
Python to report in one command
Uploading files
http://wescpy.blogspot.co.uk/2015/12/google-drive-uploading-downloading.html
Python to report in one command
Python to report in one command
Python to report in one command
Google Apps Script
• Scripting language for application
development in the Google Apps platform.
• Create custom sidebars/menus in docs,
sheets and forms.
• Based on Javascript.
Workflow
ipython
notebook
json
Google
Doc
Google
Apps Script
Python
script
Python to report in one command
What is the underlying structure of an ipython notebook?
• Four different types of cells
• Heading
• Markdown
• Raw
• Code (output)
Python to report in one command
Python to report in one command
Markdown and heading cells
Code cells: Tables
‘#% table’ at beginning of cell
Use output field (html) + beautiful soup.
Code cells: Images
‘#% figure’ at beginning of cell
Extract name of figure
Json
Workflow
ipython
notebook
json
Google
Doc
Google
Apps Script
Python
script
Python to report in one command
Python to report in one command
Python to report in one command
Python to report in one command
Python to report in one command
Python to report in one command
Python to report in one command
Python to report in one command
Python to report in one command
Python to report in one command?
Step 1: Google Drive
API to upload images
to Google Drive
ipynb
Google
Drive
Step 3: Run Google
Apps Script using the
Python Execution API.
json
Google
Doc
Step 2: Python script
to convert ipynb to
json.
What I’ve learnt and what’s next?
• Automate report writing
• Harder project that I anticipated
• Google Apps Script is very versatile
• Comments, updates/edits
• Spreadsheets

More Related Content

Viewers also liked (13)

PDF
Lightning large scale machine learning in python
PyDataParis
 
PPTX
Lo1
Tom Hibbert
 
PPTX
Unit 15 - LO1 Poster
Tom Hibbert
 
PDF
Prespective analytics with DOcplex and pandas
PyDataParis
 
PDF
Collect pydata from your processes
PyDataParis
 
PDF
Wendelin : From Stock Movements to Pivot Tables Inside Jupyter
PyDataParis
 
PPTX
UNIT 35 - LO2
Tom Hibbert
 
PDF
Simple APIs and innovative documentation
PyDataParis
 
PPTX
LO3
Tom Hibbert
 
DOC
Witness Statement
Tom Hibbert
 
PPTX
Lo3
Tom Hibbert
 
DOCX
Proposal
Tom Hibbert
 
PPTX
Pitch LO4
Tom Hibbert
 
Lightning large scale machine learning in python
PyDataParis
 
Unit 15 - LO1 Poster
Tom Hibbert
 
Prespective analytics with DOcplex and pandas
PyDataParis
 
Collect pydata from your processes
PyDataParis
 
Wendelin : From Stock Movements to Pivot Tables Inside Jupyter
PyDataParis
 
UNIT 35 - LO2
Tom Hibbert
 
Simple APIs and innovative documentation
PyDataParis
 
Witness Statement
Tom Hibbert
 
Proposal
Tom Hibbert
 
Pitch LO4
Tom Hibbert
 

Recently uploaded (20)

PDF
Blockchain Transactions Explained For Everyone
CIFDAQ
 
PDF
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
PDF
July Patch Tuesday
Ivanti
 
PDF
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
PDF
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
PPTX
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
PPTX
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
PDF
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
PDF
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
PDF
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
PPTX
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
PDF
From Code to Challenge: Crafting Skill-Based Games That Engage and Reward
aiyshauae
 
PDF
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
PDF
Biography of Daniel Podor.pdf
Daniel Podor
 
PDF
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
PPTX
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
PPTX
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
PDF
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
PDF
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
Blockchain Transactions Explained For Everyone
CIFDAQ
 
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
July Patch Tuesday
Ivanti
 
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
From Code to Challenge: Crafting Skill-Based Games That Engage and Reward
aiyshauae
 
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
Biography of Daniel Podor.pdf
Daniel Podor
 
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
Ad

Python to report in one command