SlideShare una empresa de Scribd logo
1 de 14
Descargar para leer sin conexión
THE PYTHON CHEAT SHEET FOR
THE BUSY MARKETER
H A M L E T B A T I S T A
#INBOUND2020
Google Colaboratory
feature walkthrough
GOOGLE COLAB
Preparing your Python
notebook environment
SETUP
Publish your analysis to
Google Sheets directly
from Python
EXPORTING TO SHEETS
Convert your data
analysis into simpler to
understand formats
DATA TRANSFORMATION
Process API output to
extract insights
JSON PARSING
Run automated analysis
using Google
Lighthouse
API CALLING
AGENDA
T H E P Y T H O N C H E A T S H E E T F O R T H E
B U S Y M A R K E T E R
@hamletbatista
Fetch content from the
web
WEB SCRAPING
Basic data types,
Containers, Functions,
Classes
PYTHON BASICS
INTRODUCTION
P Y T H O N S O U R C E D D A T A S T U D I E S
Published April 7, 2020
PAGE SPEED SCORES OF EVERY
SHOPIFY THEME
Published June 23, 2020
ACCESSING ‘CORE WEB VITALS’ OF
EVERY SHOPIFY THEME
Our work in this presentation
AN SEO ASSESSMENT OF EVERY
SHOPIFY THEME
#INBOUND2020
https://bit.ly/31JXHJ1https://bit.ly/38tEixp https://bit.ly/31JXHJ1
@hamletbatista
We will run Google
Lighthouse SEO analysis
feature under mobile
emulation
GOOGLE LIGHTHOUSE
We will scrape the demo
sites of every theme
SHOPIFY THEME STORE
We will use a handy cheat
sheet spread over multiple
Python notebooks
CHEAT SHEET
PYTHON SOURCED
DATA STUDY
A M O B I L E S E O A S S E S S M E N T O F E V E R Y S H O P I F Y T H E M E
#INBOUND2020 @hamletbatista
POWERED BY GOOGLE
LIGHTHOUSE
A M O B I L E S E O A S S E S S M E N T O F E V E R Y S H O P I F Y T H E M E
#INBOUND2020 @hamletbatista
We will run Google
Lighthouse SEO analysis
feature under mobile
emulation
GOOGLE LIGHTHOUSE
We will scrape the demo
sites of every theme
SHOPIFY THEME STORE
We will use a handy cheat
sheet spread over multiple
Python notebooks
CHEAT SHEET
SETUP
1
Create a new Python notebook directly from
Google Drive
#INBOUND2020
U S I N G G O O G L E C O L A B O R A T O R Y
Getting Started:
• Overview of Colaboratory Features
@hamletbatista
GOOGLE COLAB
FEATURES
T U R N N O T E B O O K S I N T O P R O G R A M S
2
Google Colab’s includes many useful
features that simplify data acquisition,
preparation and analysis.
#INBOUND2020
Most common form fields:
input1 = “value” #@param {type:”string”}
input2 = 10 #@param {type:”integer”}
input3 = “2020-09-22” #@param {type:”date”}
@hamletbatista
PYTHON
BASICS
3
Google Colab requires Python code. Let’s
let’s review some of the basic constructs.
#INBOUND2020
T H E L A N G U A G E O F D A T A S C I E N C E
@hamletbatista
Python learning resources:
• An Introduction to Python for Technical SEO
• An Introduction to Python for SEO Pros Using Spreadsheets
• How to Use Python to Analyze SEO Data: A Reference Guide
4
#INBOUND2020 @hamletbatista
WEB
SCRAPING
In our example, we will scrape the Shopify
Theme’s Store for theme names and demo
site URLs
F E T C H C O N T E N T F R O M T H E W E B
Example Scrapy spider changes:
• start_urls
• “Next page” CSS selector
• Elements to extract (theme name and link)
Learn more:
• Scrapy.org
API CALLING
5
In our example, we will call the Page Speed
Insights API to get SEO assessment metrics
and recommendations
#INBOUND2020
R U N A U T O M A T E D A N A L Y S I S
Most common request call:
r = requests.get(api_url, headers={'Accept': 'application/json'})
if r.status_code == 200:
return r.json()
Learn more:
• Requests: HTTP for Humans
@hamletbatista
JSON PARSING
P R O C E S S I N G A P I R E S P O N S E S
6
Complex JSON API responses can be a
pain to process. We will use JSONPath to
drastically simplify this.
#INBOUND2020
Most common JSONPath recipe:
json_path = “$.lighthouseResult.categories.seo.score”
jsonpath_tree = parse(json_path)
value = [match.value for match in jsonpath_tree.find(data)]
Learn more:
JSON JSONPath Tutorial
@hamletbatista
DATA
TRANSFORMATION
7
In our example, we will use Python pandas
to reorganize our study in a way that is easy
to interpret
#INBOUND2020
D A T A I S R A R E L Y I N T H E B E S T F O R M A T
Converting a list of dictionaries to Pandas Data Frame:
import pandas as pd
new_format = [{“column1_name”: “value”},{“column2_name”: “value”} ]
df = pd.DataFrame(new_format)
Learn more:
• 10 minutes to pandas
@hamletbatista
EXPORTING TO
SHEETS
G O O G L E S H E E T S I S S I M P L E R
8
Once we produce our data in Python we
can transfer it directly to Google Sheets
for further analysis and reporting
#INBOUND2020
Transferring a Pandas Data Frame to a Google Sheet :
spread = Spread("INBOUND2020", creds=creds)
spread.df_to_sheet(df, index=False, sheet="Themes SEO audits",
start='A1', replace=True)
Learn more:
• Examples of gspread Usage
• Introduction to gspread_pandas (video)
@hamletbatista
LOCATION
33 Wood Ave South
Suite 600
Iselin, NJ 08830
USA
PHONE
CONTACT US
+1 866.882.2983
https://www.ranksense.com
#INBOUND2020
ABOUT
RANKSENSE
A U T O M A T E A N D R U N S E O E X P E R I M E N T S
F R O M G O O G L E S H E E T S
@RankSense

Más contenido relacionado

La actualidad más candente

eCommerce Internal Linking - Into the Spider-Verse (BrightonSEO edition)
eCommerce Internal Linking - Into the Spider-Verse (BrightonSEO edition)eCommerce Internal Linking - Into the Spider-Verse (BrightonSEO edition)
eCommerce Internal Linking - Into the Spider-Verse (BrightonSEO edition)Kristina Azarenko
 
The Reason Behind Semantic SEO: Why does Google Avoid the Word PageRank?
The Reason Behind Semantic SEO: Why does Google Avoid the Word PageRank?The Reason Behind Semantic SEO: Why does Google Avoid the Word PageRank?
The Reason Behind Semantic SEO: Why does Google Avoid the Word PageRank?Koray Tugberk GUBUR
 
Diginius - DuckDuckGo, Privacy and the Future of Search
Diginius - DuckDuckGo, Privacy and the Future of Search Diginius - DuckDuckGo, Privacy and the Future of Search
Diginius - DuckDuckGo, Privacy and the Future of Search NateBurke1
 
Semantic Content Networks - Ranking Websites on Google with Semantic SEO
Semantic Content Networks - Ranking Websites on Google with Semantic SEOSemantic Content Networks - Ranking Websites on Google with Semantic SEO
Semantic Content Networks - Ranking Websites on Google with Semantic SEOKoray Tugberk GUBUR
 
Quality Content at Scale Through Automated Text Summarization of UGC
Quality Content at Scale Through Automated Text Summarization of UGCQuality Content at Scale Through Automated Text Summarization of UGC
Quality Content at Scale Through Automated Text Summarization of UGCHamlet Batista
 
How to Implement Machine Learning in Your Internal Linking Audit - Lazarina S...
How to Implement Machine Learning in Your Internal Linking Audit - Lazarina S...How to Implement Machine Learning in Your Internal Linking Audit - Lazarina S...
How to Implement Machine Learning in Your Internal Linking Audit - Lazarina S...LazarinaStoyanova
 
Antifragility in Digital Marketing
Antifragility in Digital MarketingAntifragility in Digital Marketing
Antifragility in Digital MarketingElias Dabbas
 
SEO Case Study - Hangikredi.com From 12 March to 24 September Core Update
SEO Case Study - Hangikredi.com From 12 March to 24 September Core UpdateSEO Case Study - Hangikredi.com From 12 March to 24 September Core Update
SEO Case Study - Hangikredi.com From 12 March to 24 September Core UpdateKoray Tugberk GUBUR
 
Brighton SEO - Luis Bueno Tabernero - How to do an ASO Audit like in the 90's...
Brighton SEO - Luis Bueno Tabernero - How to do an ASO Audit like in the 90's...Brighton SEO - Luis Bueno Tabernero - How to do an ASO Audit like in the 90's...
Brighton SEO - Luis Bueno Tabernero - How to do an ASO Audit like in the 90's...Luis
 
Beth Barnham Schema Auditing BrightonSEO Slides.pptx
Beth Barnham Schema Auditing BrightonSEO Slides.pptxBeth Barnham Schema Auditing BrightonSEO Slides.pptx
Beth Barnham Schema Auditing BrightonSEO Slides.pptxBethBarnham1
 
BrightonSEO March 2021 | Dan Taylor, Image Entity Tags
BrightonSEO March 2021 | Dan Taylor, Image Entity TagsBrightonSEO March 2021 | Dan Taylor, Image Entity Tags
BrightonSEO March 2021 | Dan Taylor, Image Entity TagsDan Taylor
 
How Search Works
How Search WorksHow Search Works
How Search WorksAhrefs
 
Internal Linking - The Topic Clustering Way edited.pptx
Internal Linking - The Topic Clustering Way edited.pptxInternal Linking - The Topic Clustering Way edited.pptx
Internal Linking - The Topic Clustering Way edited.pptxDixon Jones
 
Veronika bSEO-Googles-MUM-Speaker-Slides.pptx
Veronika bSEO-Googles-MUM-Speaker-Slides.pptxVeronika bSEO-Googles-MUM-Speaker-Slides.pptx
Veronika bSEO-Googles-MUM-Speaker-Slides.pptxVeronika Höller
 
SEO at Scale - BrightonSEO April 2022
SEO at Scale - BrightonSEO April 2022SEO at Scale - BrightonSEO April 2022
SEO at Scale - BrightonSEO April 2022Nitin Manchanda
 
How To EAT Links.pptx
How To EAT Links.pptxHow To EAT Links.pptx
How To EAT Links.pptxDixon Jones
 
7 E-Commerce SEO Mistakes & How to Fix Them #DeepSEOCon
7 E-Commerce SEO Mistakes & How to Fix Them #DeepSEOCon7 E-Commerce SEO Mistakes & How to Fix Them #DeepSEOCon
7 E-Commerce SEO Mistakes & How to Fix Them #DeepSEOConAleyda Solís
 
Product, service and category page links (and how to get them) - Rebecca Moss...
Product, service and category page links (and how to get them) - Rebecca Moss...Product, service and category page links (and how to get them) - Rebecca Moss...
Product, service and category page links (and how to get them) - Rebecca Moss...Rebecca Moss
 

La actualidad más candente (20)

eCommerce Internal Linking - Into the Spider-Verse (BrightonSEO edition)
eCommerce Internal Linking - Into the Spider-Verse (BrightonSEO edition)eCommerce Internal Linking - Into the Spider-Verse (BrightonSEO edition)
eCommerce Internal Linking - Into the Spider-Verse (BrightonSEO edition)
 
The Reason Behind Semantic SEO: Why does Google Avoid the Word PageRank?
The Reason Behind Semantic SEO: Why does Google Avoid the Word PageRank?The Reason Behind Semantic SEO: Why does Google Avoid the Word PageRank?
The Reason Behind Semantic SEO: Why does Google Avoid the Word PageRank?
 
Diginius - DuckDuckGo, Privacy and the Future of Search
Diginius - DuckDuckGo, Privacy and the Future of Search Diginius - DuckDuckGo, Privacy and the Future of Search
Diginius - DuckDuckGo, Privacy and the Future of Search
 
40 Deep #SEO Insights for 2023
40 Deep #SEO Insights for 202340 Deep #SEO Insights for 2023
40 Deep #SEO Insights for 2023
 
Semantic Content Networks - Ranking Websites on Google with Semantic SEO
Semantic Content Networks - Ranking Websites on Google with Semantic SEOSemantic Content Networks - Ranking Websites on Google with Semantic SEO
Semantic Content Networks - Ranking Websites on Google with Semantic SEO
 
Quality Content at Scale Through Automated Text Summarization of UGC
Quality Content at Scale Through Automated Text Summarization of UGCQuality Content at Scale Through Automated Text Summarization of UGC
Quality Content at Scale Through Automated Text Summarization of UGC
 
How to Implement Machine Learning in Your Internal Linking Audit - Lazarina S...
How to Implement Machine Learning in Your Internal Linking Audit - Lazarina S...How to Implement Machine Learning in Your Internal Linking Audit - Lazarina S...
How to Implement Machine Learning in Your Internal Linking Audit - Lazarina S...
 
Antifragility in Digital Marketing
Antifragility in Digital MarketingAntifragility in Digital Marketing
Antifragility in Digital Marketing
 
SEO Case Study - Hangikredi.com From 12 March to 24 September Core Update
SEO Case Study - Hangikredi.com From 12 March to 24 September Core UpdateSEO Case Study - Hangikredi.com From 12 March to 24 September Core Update
SEO Case Study - Hangikredi.com From 12 March to 24 September Core Update
 
Brighton SEO - Luis Bueno Tabernero - How to do an ASO Audit like in the 90's...
Brighton SEO - Luis Bueno Tabernero - How to do an ASO Audit like in the 90's...Brighton SEO - Luis Bueno Tabernero - How to do an ASO Audit like in the 90's...
Brighton SEO - Luis Bueno Tabernero - How to do an ASO Audit like in the 90's...
 
Beth Barnham Schema Auditing BrightonSEO Slides.pptx
Beth Barnham Schema Auditing BrightonSEO Slides.pptxBeth Barnham Schema Auditing BrightonSEO Slides.pptx
Beth Barnham Schema Auditing BrightonSEO Slides.pptx
 
BrightonSEO March 2021 | Dan Taylor, Image Entity Tags
BrightonSEO March 2021 | Dan Taylor, Image Entity TagsBrightonSEO March 2021 | Dan Taylor, Image Entity Tags
BrightonSEO March 2021 | Dan Taylor, Image Entity Tags
 
How Search Works
How Search WorksHow Search Works
How Search Works
 
Internal Linking - The Topic Clustering Way edited.pptx
Internal Linking - The Topic Clustering Way edited.pptxInternal Linking - The Topic Clustering Way edited.pptx
Internal Linking - The Topic Clustering Way edited.pptx
 
Veronika bSEO-Googles-MUM-Speaker-Slides.pptx
Veronika bSEO-Googles-MUM-Speaker-Slides.pptxVeronika bSEO-Googles-MUM-Speaker-Slides.pptx
Veronika bSEO-Googles-MUM-Speaker-Slides.pptx
 
How to control googlebot
How to control googlebotHow to control googlebot
How to control googlebot
 
SEO at Scale - BrightonSEO April 2022
SEO at Scale - BrightonSEO April 2022SEO at Scale - BrightonSEO April 2022
SEO at Scale - BrightonSEO April 2022
 
How To EAT Links.pptx
How To EAT Links.pptxHow To EAT Links.pptx
How To EAT Links.pptx
 
7 E-Commerce SEO Mistakes & How to Fix Them #DeepSEOCon
7 E-Commerce SEO Mistakes & How to Fix Them #DeepSEOCon7 E-Commerce SEO Mistakes & How to Fix Them #DeepSEOCon
7 E-Commerce SEO Mistakes & How to Fix Them #DeepSEOCon
 
Product, service and category page links (and how to get them) - Rebecca Moss...
Product, service and category page links (and how to get them) - Rebecca Moss...Product, service and category page links (and how to get them) - Rebecca Moss...
Product, service and category page links (and how to get them) - Rebecca Moss...
 

Similar a The Python Cheat Sheet for the Busy Marketer

Lessons Learned - Building YDN
Lessons Learned - Building YDNLessons Learned - Building YDN
Lessons Learned - Building YDNDan Theurer
 
From Knowledge Graphs to AI-powered SEO: Using taxonomies, schemas and knowle...
From Knowledge Graphs to AI-powered SEO: Using taxonomies, schemas and knowle...From Knowledge Graphs to AI-powered SEO: Using taxonomies, schemas and knowle...
From Knowledge Graphs to AI-powered SEO: Using taxonomies, schemas and knowle...Connected Data World
 
AI Deeplearning Programming
AI Deeplearning ProgrammingAI Deeplearning Programming
AI Deeplearning ProgrammingPaulSombat
 
Google Opening up to Developers - From 2 to 55 APIs in 3 years
Google Opening up to Developers - From 2 to 55 APIs in 3 yearsGoogle Opening up to Developers - From 2 to 55 APIs in 3 years
Google Opening up to Developers - From 2 to 55 APIs in 3 yearsPatrick Chanezon
 
apidays Paris 2022 - France Televisions : How we leverage API Platform for ou...
apidays Paris 2022 - France Televisions : How we leverage API Platform for ou...apidays Paris 2022 - France Televisions : How we leverage API Platform for ou...
apidays Paris 2022 - France Televisions : How we leverage API Platform for ou...apidays
 
Developer Grade SEO
Developer Grade SEODeveloper Grade SEO
Developer Grade SEOPhil Buckley
 
Building Beautiful REST APIs with ASP.NET Core
Building Beautiful REST APIs with ASP.NET CoreBuilding Beautiful REST APIs with ASP.NET Core
Building Beautiful REST APIs with ASP.NET CoreStormpath
 
Solving performance issues in Django ORM
Solving performance issues in Django ORMSolving performance issues in Django ORM
Solving performance issues in Django ORMSian Lerk Lau
 
Natural Language Processing sample code by Aiden
Natural Language Processing sample code by AidenNatural Language Processing sample code by Aiden
Natural Language Processing sample code by AidenAiden Wu, FRM
 
Velocity Conference - What do cats and APIs have in common? They are both awe...
Velocity Conference - What do cats and APIs have in common? They are both awe...Velocity Conference - What do cats and APIs have in common? They are both awe...
Velocity Conference - What do cats and APIs have in common? They are both awe...Stephen Fishman
 
Intro To Spring Python
Intro To Spring PythonIntro To Spring Python
Intro To Spring Pythongturnquist
 
API Integration in Web Application
API Integration in Web ApplicationAPI Integration in Web Application
API Integration in Web Applicationijtsrd
 
How fiddling with GraphQL enhanced communications between our back and front ...
How fiddling with GraphQL enhanced communications between our back and front ...How fiddling with GraphQL enhanced communications between our back and front ...
How fiddling with GraphQL enhanced communications between our back and front ...CALLR
 
Yahoo! BOSS in Bucharest
Yahoo! BOSS in BucharestYahoo! BOSS in Bucharest
Yahoo! BOSS in BucharestTed Drake
 
the Spring Update from JavaOne 2013
the Spring Update from JavaOne 2013the Spring Update from JavaOne 2013
the Spring Update from JavaOne 2013Joshua Long
 
Data Curation @ SpazioDati - NEXA Lunch Seminar
Data Curation @ SpazioDati - NEXA Lunch SeminarData Curation @ SpazioDati - NEXA Lunch Seminar
Data Curation @ SpazioDati - NEXA Lunch SeminarSpazioDati
 
Python分享
Python分享Python分享
Python分享fangdeng
 

Similar a The Python Cheat Sheet for the Busy Marketer (20)

Lessons Learned - Building YDN
Lessons Learned - Building YDNLessons Learned - Building YDN
Lessons Learned - Building YDN
 
From Knowledge Graphs to AI-powered SEO: Using taxonomies, schemas and knowle...
From Knowledge Graphs to AI-powered SEO: Using taxonomies, schemas and knowle...From Knowledge Graphs to AI-powered SEO: Using taxonomies, schemas and knowle...
From Knowledge Graphs to AI-powered SEO: Using taxonomies, schemas and knowle...
 
AI Deeplearning Programming
AI Deeplearning ProgrammingAI Deeplearning Programming
AI Deeplearning Programming
 
Google Opening up to Developers - From 2 to 55 APIs in 3 years
Google Opening up to Developers - From 2 to 55 APIs in 3 yearsGoogle Opening up to Developers - From 2 to 55 APIs in 3 years
Google Opening up to Developers - From 2 to 55 APIs in 3 years
 
apidays Paris 2022 - France Televisions : How we leverage API Platform for ou...
apidays Paris 2022 - France Televisions : How we leverage API Platform for ou...apidays Paris 2022 - France Televisions : How we leverage API Platform for ou...
apidays Paris 2022 - France Televisions : How we leverage API Platform for ou...
 
Developer Grade SEO
Developer Grade SEODeveloper Grade SEO
Developer Grade SEO
 
Building Beautiful REST APIs with ASP.NET Core
Building Beautiful REST APIs with ASP.NET CoreBuilding Beautiful REST APIs with ASP.NET Core
Building Beautiful REST APIs with ASP.NET Core
 
Solving performance issues in Django ORM
Solving performance issues in Django ORMSolving performance issues in Django ORM
Solving performance issues in Django ORM
 
Resume analyst
Resume analystResume analyst
Resume analyst
 
Natural Language Processing sample code by Aiden
Natural Language Processing sample code by AidenNatural Language Processing sample code by Aiden
Natural Language Processing sample code by Aiden
 
Introduction to python scrapping
Introduction to python scrappingIntroduction to python scrapping
Introduction to python scrapping
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
 
Velocity Conference - What do cats and APIs have in common? They are both awe...
Velocity Conference - What do cats and APIs have in common? They are both awe...Velocity Conference - What do cats and APIs have in common? They are both awe...
Velocity Conference - What do cats and APIs have in common? They are both awe...
 
Intro To Spring Python
Intro To Spring PythonIntro To Spring Python
Intro To Spring Python
 
API Integration in Web Application
API Integration in Web ApplicationAPI Integration in Web Application
API Integration in Web Application
 
How fiddling with GraphQL enhanced communications between our back and front ...
How fiddling with GraphQL enhanced communications between our back and front ...How fiddling with GraphQL enhanced communications between our back and front ...
How fiddling with GraphQL enhanced communications between our back and front ...
 
Yahoo! BOSS in Bucharest
Yahoo! BOSS in BucharestYahoo! BOSS in Bucharest
Yahoo! BOSS in Bucharest
 
the Spring Update from JavaOne 2013
the Spring Update from JavaOne 2013the Spring Update from JavaOne 2013
the Spring Update from JavaOne 2013
 
Data Curation @ SpazioDati - NEXA Lunch Seminar
Data Curation @ SpazioDati - NEXA Lunch SeminarData Curation @ SpazioDati - NEXA Lunch Seminar
Data Curation @ SpazioDati - NEXA Lunch Seminar
 
Python分享
Python分享Python分享
Python分享
 

Más de Hamlet Batista

A Deep Dive Into SEO Tactics For Modern Javascript Frameworks
A Deep Dive Into SEO Tactics For Modern Javascript FrameworksA Deep Dive Into SEO Tactics For Modern Javascript Frameworks
A Deep Dive Into SEO Tactics For Modern Javascript FrameworksHamlet Batista
 
Automated Duplicate Content Consolidation with Google Cloud Functions
Automated Duplicate Content Consolidation with Google Cloud FunctionsAutomated Duplicate Content Consolidation with Google Cloud Functions
Automated Duplicate Content Consolidation with Google Cloud FunctionsHamlet Batista
 
Creando una Sección de FAQS y su Marcado de Datos Estructurados en 30 Minutos
Creando una Sección de FAQS y su Marcado de Datos Estructurados en 30 MinutosCreando una Sección de FAQS y su Marcado de Datos Estructurados en 30 Minutos
Creando una Sección de FAQS y su Marcado de Datos Estructurados en 30 MinutosHamlet Batista
 
Doing More with Less: Automated, High-Quality Content Generation
Doing More with Less: Automated, High-Quality Content GenerationDoing More with Less: Automated, High-Quality Content Generation
Doing More with Less: Automated, High-Quality Content GenerationHamlet Batista
 
How to scale SEO work NOBODY wants to do (including your competitors) to rapi...
How to scale SEO work NOBODY wants to do (including your competitors) to rapi...How to scale SEO work NOBODY wants to do (including your competitors) to rapi...
How to scale SEO work NOBODY wants to do (including your competitors) to rapi...Hamlet Batista
 
Agile SEO: Faster SEO Results
Agile SEO: Faster SEO ResultsAgile SEO: Faster SEO Results
Agile SEO: Faster SEO ResultsHamlet Batista
 
Scaling Keyword Research to Find Content Gaps
Scaling Keyword Research to Find Content GapsScaling Keyword Research to Find Content Gaps
Scaling Keyword Research to Find Content GapsHamlet Batista
 
Query Classification on Steroids with BERT
Query Classification on Steroids with BERTQuery Classification on Steroids with BERT
Query Classification on Steroids with BERTHamlet Batista
 
Solving Complex JavaScript Issues and Leveraging Semantic HTML5
Solving Complex JavaScript Issues and Leveraging Semantic HTML5Solving Complex JavaScript Issues and Leveraging Semantic HTML5
Solving Complex JavaScript Issues and Leveraging Semantic HTML5Hamlet Batista
 
Python for Data-driven Storytelling
Python for Data-driven StorytellingPython for Data-driven Storytelling
Python for Data-driven StorytellingHamlet Batista
 
Scaling automated quality text generation for enterprise sites
Scaling automated quality text generation for enterprise sitesScaling automated quality text generation for enterprise sites
Scaling automated quality text generation for enterprise sitesHamlet Batista
 
The New Renaissance of JavaScript
The New Renaissance of JavaScriptThe New Renaissance of JavaScript
The New Renaissance of JavaScriptHamlet Batista
 
Data and Evidence-driven SEO
Data and Evidence-driven SEOData and Evidence-driven SEO
Data and Evidence-driven SEOHamlet Batista
 
Advanced Data-Driven SEO
Advanced Data-Driven SEOAdvanced Data-Driven SEO
Advanced Data-Driven SEOHamlet Batista
 
Technical SEO "Overoptimization"
Technical SEO "Overoptimization"Technical SEO "Overoptimization"
Technical SEO "Overoptimization"Hamlet Batista
 
Why Pay for Performance When You Can Lead the World To Your Door for Free?
Why Pay for Performance When You Can Lead the World To Your Door for Free?Why Pay for Performance When You Can Lead the World To Your Door for Free?
Why Pay for Performance When You Can Lead the World To Your Door for Free?Hamlet Batista
 
Gettin' It Up And Keepin' It Up in Google
Gettin' It Up And Keepin' It Up in GoogleGettin' It Up And Keepin' It Up in Google
Gettin' It Up And Keepin' It Up in GoogleHamlet Batista
 
Batista, Hamlet, Beyond The Usual Link Building
Batista, Hamlet, Beyond The Usual Link BuildingBatista, Hamlet, Beyond The Usual Link Building
Batista, Hamlet, Beyond The Usual Link BuildingHamlet Batista
 

Más de Hamlet Batista (20)

A Deep Dive Into SEO Tactics For Modern Javascript Frameworks
A Deep Dive Into SEO Tactics For Modern Javascript FrameworksA Deep Dive Into SEO Tactics For Modern Javascript Frameworks
A Deep Dive Into SEO Tactics For Modern Javascript Frameworks
 
Automated Duplicate Content Consolidation with Google Cloud Functions
Automated Duplicate Content Consolidation with Google Cloud FunctionsAutomated Duplicate Content Consolidation with Google Cloud Functions
Automated Duplicate Content Consolidation with Google Cloud Functions
 
SEO Meets Automation
SEO Meets AutomationSEO Meets Automation
SEO Meets Automation
 
Creando una Sección de FAQS y su Marcado de Datos Estructurados en 30 Minutos
Creando una Sección de FAQS y su Marcado de Datos Estructurados en 30 MinutosCreando una Sección de FAQS y su Marcado de Datos Estructurados en 30 Minutos
Creando una Sección de FAQS y su Marcado de Datos Estructurados en 30 Minutos
 
Doing More with Less: Automated, High-Quality Content Generation
Doing More with Less: Automated, High-Quality Content GenerationDoing More with Less: Automated, High-Quality Content Generation
Doing More with Less: Automated, High-Quality Content Generation
 
How to scale SEO work NOBODY wants to do (including your competitors) to rapi...
How to scale SEO work NOBODY wants to do (including your competitors) to rapi...How to scale SEO work NOBODY wants to do (including your competitors) to rapi...
How to scale SEO work NOBODY wants to do (including your competitors) to rapi...
 
Agile SEO: Faster SEO Results
Agile SEO: Faster SEO ResultsAgile SEO: Faster SEO Results
Agile SEO: Faster SEO Results
 
Scaling Keyword Research to Find Content Gaps
Scaling Keyword Research to Find Content GapsScaling Keyword Research to Find Content Gaps
Scaling Keyword Research to Find Content Gaps
 
Query Classification on Steroids with BERT
Query Classification on Steroids with BERTQuery Classification on Steroids with BERT
Query Classification on Steroids with BERT
 
Solving Complex JavaScript Issues and Leveraging Semantic HTML5
Solving Complex JavaScript Issues and Leveraging Semantic HTML5Solving Complex JavaScript Issues and Leveraging Semantic HTML5
Solving Complex JavaScript Issues and Leveraging Semantic HTML5
 
Python for Data-driven Storytelling
Python for Data-driven StorytellingPython for Data-driven Storytelling
Python for Data-driven Storytelling
 
Scaling automated quality text generation for enterprise sites
Scaling automated quality text generation for enterprise sitesScaling automated quality text generation for enterprise sites
Scaling automated quality text generation for enterprise sites
 
The New Renaissance of JavaScript
The New Renaissance of JavaScriptThe New Renaissance of JavaScript
The New Renaissance of JavaScript
 
Data and Evidence-driven SEO
Data and Evidence-driven SEOData and Evidence-driven SEO
Data and Evidence-driven SEO
 
Python for SEO
Python for SEOPython for SEO
Python for SEO
 
Advanced Data-Driven SEO
Advanced Data-Driven SEOAdvanced Data-Driven SEO
Advanced Data-Driven SEO
 
Technical SEO "Overoptimization"
Technical SEO "Overoptimization"Technical SEO "Overoptimization"
Technical SEO "Overoptimization"
 
Why Pay for Performance When You Can Lead the World To Your Door for Free?
Why Pay for Performance When You Can Lead the World To Your Door for Free?Why Pay for Performance When You Can Lead the World To Your Door for Free?
Why Pay for Performance When You Can Lead the World To Your Door for Free?
 
Gettin' It Up And Keepin' It Up in Google
Gettin' It Up And Keepin' It Up in GoogleGettin' It Up And Keepin' It Up in Google
Gettin' It Up And Keepin' It Up in Google
 
Batista, Hamlet, Beyond The Usual Link Building
Batista, Hamlet, Beyond The Usual Link BuildingBatista, Hamlet, Beyond The Usual Link Building
Batista, Hamlet, Beyond The Usual Link Building
 

Último

Elevate Your Advertising Game: Introducing Billion Broadcaster Lift Advertising
Elevate Your Advertising Game: Introducing Billion Broadcaster Lift AdvertisingElevate Your Advertising Game: Introducing Billion Broadcaster Lift Advertising
Elevate Your Advertising Game: Introducing Billion Broadcaster Lift AdvertisingVikasYadav194549
 
Mastering Affiliate Marketing: A Comprehensive Guide to Success
Mastering Affiliate Marketing: A Comprehensive Guide to SuccessMastering Affiliate Marketing: A Comprehensive Guide to Success
Mastering Affiliate Marketing: A Comprehensive Guide to SuccessAbdulsamad Lukman
 
Unlocking the Mystery of the Voynich Manuscript
Unlocking the Mystery of the Voynich ManuscriptUnlocking the Mystery of the Voynich Manuscript
Unlocking the Mystery of the Voynich Manuscriptelizabethella096
 
Resumé Karina Perez | Digital Strategist
Resumé Karina Perez | Digital StrategistResumé Karina Perez | Digital Strategist
Resumé Karina Perez | Digital StrategistKarina Perez
 
Aligarh Hire 💕 8250092165 Young and Hot Call Girls Service Agency Escorts
Aligarh Hire 💕 8250092165 Young and Hot Call Girls Service Agency EscortsAligarh Hire 💕 8250092165 Young and Hot Call Girls Service Agency Escorts
Aligarh Hire 💕 8250092165 Young and Hot Call Girls Service Agency Escortsmeghakumariji156
 
W.H.Bender Quote 61 -Influential restaurant and food service industry network...
W.H.Bender Quote 61 -Influential restaurant and food service industry network...W.H.Bender Quote 61 -Influential restaurant and food service industry network...
W.H.Bender Quote 61 -Influential restaurant and food service industry network...William (Bill) H. Bender, FCSI
 
Elevating Your Digital Presence by Evitha.pdf
Elevating Your Digital Presence by Evitha.pdfElevating Your Digital Presence by Evitha.pdf
Elevating Your Digital Presence by Evitha.pdfevithatojoparel
 
Alpha Media March 2024 Buyers Guide.pptx
Alpha Media March 2024 Buyers Guide.pptxAlpha Media March 2024 Buyers Guide.pptx
Alpha Media March 2024 Buyers Guide.pptxDave McCallum
 
Rise and fall of Kulula.com, an airline won consumers by different marketing ...
Rise and fall of Kulula.com, an airline won consumers by different marketing ...Rise and fall of Kulula.com, an airline won consumers by different marketing ...
Rise and fall of Kulula.com, an airline won consumers by different marketing ...ssusereaa7d9
 
Social Media Marketing Portfolio - Maharsh Benday
Social Media Marketing Portfolio - Maharsh BendaySocial Media Marketing Portfolio - Maharsh Benday
Social Media Marketing Portfolio - Maharsh BendayMaharshBenday
 
Crypto Quantum Leap - Digital - membership area
Crypto Quantum Leap -  Digital - membership areaCrypto Quantum Leap -  Digital - membership area
Crypto Quantum Leap - Digital - membership areajaynee G
 
The 9th May Incident in Pakistan A Turning Point in History.pptx
The 9th May Incident in Pakistan A Turning Point in History.pptxThe 9th May Incident in Pakistan A Turning Point in History.pptx
The 9th May Incident in Pakistan A Turning Point in History.pptxelizabethella096
 
Best 5 Graphics Designing Course In Chandigarh
Best 5 Graphics Designing Course In ChandigarhBest 5 Graphics Designing Course In Chandigarh
Best 5 Graphics Designing Course In Chandigarhhamitthakurdma01
 
Cartona.pptx. Marketing how to present your project very well , discussed a...
Cartona.pptx.   Marketing how to present your project very well , discussed a...Cartona.pptx.   Marketing how to present your project very well , discussed a...
Cartona.pptx. Marketing how to present your project very well , discussed a...BeshoyFawaz1
 
Tata Punch brochure with complete detail of all the variants
Tata Punch brochure with complete detail of all the variantsTata Punch brochure with complete detail of all the variants
Tata Punch brochure with complete detail of all the variantsRiteshVishambhari
 
[Expert Panel] New Google Shopping Ads Strategies Uncovered
[Expert Panel] New Google Shopping Ads Strategies Uncovered[Expert Panel] New Google Shopping Ads Strategies Uncovered
[Expert Panel] New Google Shopping Ads Strategies UncoveredSearch Engine Journal
 
Enhancing Business Visibility PR Firms in San Francisco
Enhancing Business Visibility PR Firms in San FranciscoEnhancing Business Visibility PR Firms in San Francisco
Enhancing Business Visibility PR Firms in San Franciscosanfranciscoprfirms
 
Social Media Marketing Portfolio - Maharsh Benday
Social Media Marketing Portfolio - Maharsh BendaySocial Media Marketing Portfolio - Maharsh Benday
Social Media Marketing Portfolio - Maharsh BendayMaharshBenday
 
TAM_AdEx-Cross_Media_Report-Banking_Finance_Investment_(BFSI)_2023.pdf
TAM_AdEx-Cross_Media_Report-Banking_Finance_Investment_(BFSI)_2023.pdfTAM_AdEx-Cross_Media_Report-Banking_Finance_Investment_(BFSI)_2023.pdf
TAM_AdEx-Cross_Media_Report-Banking_Finance_Investment_(BFSI)_2023.pdfSocial Samosa
 

Último (20)

Elevate Your Advertising Game: Introducing Billion Broadcaster Lift Advertising
Elevate Your Advertising Game: Introducing Billion Broadcaster Lift AdvertisingElevate Your Advertising Game: Introducing Billion Broadcaster Lift Advertising
Elevate Your Advertising Game: Introducing Billion Broadcaster Lift Advertising
 
Mastering Affiliate Marketing: A Comprehensive Guide to Success
Mastering Affiliate Marketing: A Comprehensive Guide to SuccessMastering Affiliate Marketing: A Comprehensive Guide to Success
Mastering Affiliate Marketing: A Comprehensive Guide to Success
 
Unlocking the Mystery of the Voynich Manuscript
Unlocking the Mystery of the Voynich ManuscriptUnlocking the Mystery of the Voynich Manuscript
Unlocking the Mystery of the Voynich Manuscript
 
Resumé Karina Perez | Digital Strategist
Resumé Karina Perez | Digital StrategistResumé Karina Perez | Digital Strategist
Resumé Karina Perez | Digital Strategist
 
Aligarh Hire 💕 8250092165 Young and Hot Call Girls Service Agency Escorts
Aligarh Hire 💕 8250092165 Young and Hot Call Girls Service Agency EscortsAligarh Hire 💕 8250092165 Young and Hot Call Girls Service Agency Escorts
Aligarh Hire 💕 8250092165 Young and Hot Call Girls Service Agency Escorts
 
W.H.Bender Quote 61 -Influential restaurant and food service industry network...
W.H.Bender Quote 61 -Influential restaurant and food service industry network...W.H.Bender Quote 61 -Influential restaurant and food service industry network...
W.H.Bender Quote 61 -Influential restaurant and food service industry network...
 
Elevating Your Digital Presence by Evitha.pdf
Elevating Your Digital Presence by Evitha.pdfElevating Your Digital Presence by Evitha.pdf
Elevating Your Digital Presence by Evitha.pdf
 
Alpha Media March 2024 Buyers Guide.pptx
Alpha Media March 2024 Buyers Guide.pptxAlpha Media March 2024 Buyers Guide.pptx
Alpha Media March 2024 Buyers Guide.pptx
 
Rise and fall of Kulula.com, an airline won consumers by different marketing ...
Rise and fall of Kulula.com, an airline won consumers by different marketing ...Rise and fall of Kulula.com, an airline won consumers by different marketing ...
Rise and fall of Kulula.com, an airline won consumers by different marketing ...
 
Social Media Marketing Portfolio - Maharsh Benday
Social Media Marketing Portfolio - Maharsh BendaySocial Media Marketing Portfolio - Maharsh Benday
Social Media Marketing Portfolio - Maharsh Benday
 
Crypto Quantum Leap - Digital - membership area
Crypto Quantum Leap -  Digital - membership areaCrypto Quantum Leap -  Digital - membership area
Crypto Quantum Leap - Digital - membership area
 
4 TRIK CARA MENGGUGURKAN JANIN ATAU ABORSI KANDUNGAN
4 TRIK CARA MENGGUGURKAN JANIN ATAU ABORSI KANDUNGAN4 TRIK CARA MENGGUGURKAN JANIN ATAU ABORSI KANDUNGAN
4 TRIK CARA MENGGUGURKAN JANIN ATAU ABORSI KANDUNGAN
 
The 9th May Incident in Pakistan A Turning Point in History.pptx
The 9th May Incident in Pakistan A Turning Point in History.pptxThe 9th May Incident in Pakistan A Turning Point in History.pptx
The 9th May Incident in Pakistan A Turning Point in History.pptx
 
Best 5 Graphics Designing Course In Chandigarh
Best 5 Graphics Designing Course In ChandigarhBest 5 Graphics Designing Course In Chandigarh
Best 5 Graphics Designing Course In Chandigarh
 
Cartona.pptx. Marketing how to present your project very well , discussed a...
Cartona.pptx.   Marketing how to present your project very well , discussed a...Cartona.pptx.   Marketing how to present your project very well , discussed a...
Cartona.pptx. Marketing how to present your project very well , discussed a...
 
Tata Punch brochure with complete detail of all the variants
Tata Punch brochure with complete detail of all the variantsTata Punch brochure with complete detail of all the variants
Tata Punch brochure with complete detail of all the variants
 
[Expert Panel] New Google Shopping Ads Strategies Uncovered
[Expert Panel] New Google Shopping Ads Strategies Uncovered[Expert Panel] New Google Shopping Ads Strategies Uncovered
[Expert Panel] New Google Shopping Ads Strategies Uncovered
 
Enhancing Business Visibility PR Firms in San Francisco
Enhancing Business Visibility PR Firms in San FranciscoEnhancing Business Visibility PR Firms in San Francisco
Enhancing Business Visibility PR Firms in San Francisco
 
Social Media Marketing Portfolio - Maharsh Benday
Social Media Marketing Portfolio - Maharsh BendaySocial Media Marketing Portfolio - Maharsh Benday
Social Media Marketing Portfolio - Maharsh Benday
 
TAM_AdEx-Cross_Media_Report-Banking_Finance_Investment_(BFSI)_2023.pdf
TAM_AdEx-Cross_Media_Report-Banking_Finance_Investment_(BFSI)_2023.pdfTAM_AdEx-Cross_Media_Report-Banking_Finance_Investment_(BFSI)_2023.pdf
TAM_AdEx-Cross_Media_Report-Banking_Finance_Investment_(BFSI)_2023.pdf
 

The Python Cheat Sheet for the Busy Marketer

  • 1. THE PYTHON CHEAT SHEET FOR THE BUSY MARKETER H A M L E T B A T I S T A #INBOUND2020
  • 2. Google Colaboratory feature walkthrough GOOGLE COLAB Preparing your Python notebook environment SETUP Publish your analysis to Google Sheets directly from Python EXPORTING TO SHEETS Convert your data analysis into simpler to understand formats DATA TRANSFORMATION Process API output to extract insights JSON PARSING Run automated analysis using Google Lighthouse API CALLING AGENDA T H E P Y T H O N C H E A T S H E E T F O R T H E B U S Y M A R K E T E R @hamletbatista Fetch content from the web WEB SCRAPING Basic data types, Containers, Functions, Classes PYTHON BASICS
  • 3. INTRODUCTION P Y T H O N S O U R C E D D A T A S T U D I E S Published April 7, 2020 PAGE SPEED SCORES OF EVERY SHOPIFY THEME Published June 23, 2020 ACCESSING ‘CORE WEB VITALS’ OF EVERY SHOPIFY THEME Our work in this presentation AN SEO ASSESSMENT OF EVERY SHOPIFY THEME #INBOUND2020 https://bit.ly/31JXHJ1https://bit.ly/38tEixp https://bit.ly/31JXHJ1 @hamletbatista
  • 4. We will run Google Lighthouse SEO analysis feature under mobile emulation GOOGLE LIGHTHOUSE We will scrape the demo sites of every theme SHOPIFY THEME STORE We will use a handy cheat sheet spread over multiple Python notebooks CHEAT SHEET PYTHON SOURCED DATA STUDY A M O B I L E S E O A S S E S S M E N T O F E V E R Y S H O P I F Y T H E M E #INBOUND2020 @hamletbatista
  • 5. POWERED BY GOOGLE LIGHTHOUSE A M O B I L E S E O A S S E S S M E N T O F E V E R Y S H O P I F Y T H E M E #INBOUND2020 @hamletbatista We will run Google Lighthouse SEO analysis feature under mobile emulation GOOGLE LIGHTHOUSE We will scrape the demo sites of every theme SHOPIFY THEME STORE We will use a handy cheat sheet spread over multiple Python notebooks CHEAT SHEET
  • 6. SETUP 1 Create a new Python notebook directly from Google Drive #INBOUND2020 U S I N G G O O G L E C O L A B O R A T O R Y Getting Started: • Overview of Colaboratory Features @hamletbatista
  • 7. GOOGLE COLAB FEATURES T U R N N O T E B O O K S I N T O P R O G R A M S 2 Google Colab’s includes many useful features that simplify data acquisition, preparation and analysis. #INBOUND2020 Most common form fields: input1 = “value” #@param {type:”string”} input2 = 10 #@param {type:”integer”} input3 = “2020-09-22” #@param {type:”date”} @hamletbatista
  • 8. PYTHON BASICS 3 Google Colab requires Python code. Let’s let’s review some of the basic constructs. #INBOUND2020 T H E L A N G U A G E O F D A T A S C I E N C E @hamletbatista Python learning resources: • An Introduction to Python for Technical SEO • An Introduction to Python for SEO Pros Using Spreadsheets • How to Use Python to Analyze SEO Data: A Reference Guide
  • 9. 4 #INBOUND2020 @hamletbatista WEB SCRAPING In our example, we will scrape the Shopify Theme’s Store for theme names and demo site URLs F E T C H C O N T E N T F R O M T H E W E B Example Scrapy spider changes: • start_urls • “Next page” CSS selector • Elements to extract (theme name and link) Learn more: • Scrapy.org
  • 10. API CALLING 5 In our example, we will call the Page Speed Insights API to get SEO assessment metrics and recommendations #INBOUND2020 R U N A U T O M A T E D A N A L Y S I S Most common request call: r = requests.get(api_url, headers={'Accept': 'application/json'}) if r.status_code == 200: return r.json() Learn more: • Requests: HTTP for Humans @hamletbatista
  • 11. JSON PARSING P R O C E S S I N G A P I R E S P O N S E S 6 Complex JSON API responses can be a pain to process. We will use JSONPath to drastically simplify this. #INBOUND2020 Most common JSONPath recipe: json_path = “$.lighthouseResult.categories.seo.score” jsonpath_tree = parse(json_path) value = [match.value for match in jsonpath_tree.find(data)] Learn more: JSON JSONPath Tutorial @hamletbatista
  • 12. DATA TRANSFORMATION 7 In our example, we will use Python pandas to reorganize our study in a way that is easy to interpret #INBOUND2020 D A T A I S R A R E L Y I N T H E B E S T F O R M A T Converting a list of dictionaries to Pandas Data Frame: import pandas as pd new_format = [{“column1_name”: “value”},{“column2_name”: “value”} ] df = pd.DataFrame(new_format) Learn more: • 10 minutes to pandas @hamletbatista
  • 13. EXPORTING TO SHEETS G O O G L E S H E E T S I S S I M P L E R 8 Once we produce our data in Python we can transfer it directly to Google Sheets for further analysis and reporting #INBOUND2020 Transferring a Pandas Data Frame to a Google Sheet : spread = Spread("INBOUND2020", creds=creds) spread.df_to_sheet(df, index=False, sheet="Themes SEO audits", start='A1', replace=True) Learn more: • Examples of gspread Usage • Introduction to gspread_pandas (video) @hamletbatista
  • 14. LOCATION 33 Wood Ave South Suite 600 Iselin, NJ 08830 USA PHONE CONTACT US +1 866.882.2983 https://www.ranksense.com #INBOUND2020 ABOUT RANKSENSE A U T O M A T E A N D R U N S E O E X P E R I M E N T S F R O M G O O G L E S H E E T S @RankSense