SlideShare ist ein Scribd-Unternehmen logo
1 von 14
Downloaden Sie, um offline zu lesen
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

Weitere ähnliche Inhalte

Was ist angesagt?

Natural Semantic SEO - Surfacing Walnuts in Densely Represented, Every Increa...
Natural Semantic SEO - Surfacing Walnuts in Densely Represented, Every Increa...Natural Semantic SEO - Surfacing Walnuts in Densely Represented, Every Increa...
Natural Semantic SEO - Surfacing Walnuts in Densely Represented, Every Increa...Dawn Anderson MSc DigM
 
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
 
Kleecks - AI-Martech as a game changer-DEF.pdf
Kleecks - AI-Martech as a game changer-DEF.pdfKleecks - AI-Martech as a game changer-DEF.pdf
Kleecks - AI-Martech as a game changer-DEF.pdfKleecks
 
BrightonSEO - Apr 2022 - No excuses for doing UX
BrightonSEO - Apr 2022 - No excuses for doing UXBrightonSEO - Apr 2022 - No excuses for doing UX
BrightonSEO - Apr 2022 - No excuses for doing UXOban International
 
Search Query Processing: The Secret Life of Queries, Parsing, Rewriting & SEO
Search Query Processing: The Secret Life of Queries, Parsing, Rewriting & SEOSearch Query Processing: The Secret Life of Queries, Parsing, Rewriting & SEO
Search Query Processing: The Secret Life of Queries, Parsing, Rewriting & SEOKoray Tugberk GUBUR
 
Data Studio for SEOs: Reporting Automation Tips - Weekly SEO with Lazarina Stoy
Data Studio for SEOs: Reporting Automation Tips - Weekly SEO with Lazarina StoyData Studio for SEOs: Reporting Automation Tips - Weekly SEO with Lazarina Stoy
Data Studio for SEOs: Reporting Automation Tips - Weekly SEO with Lazarina StoyLazarinaStoyanova
 
Keyword Research and Topic Modeling in a Semantic Web
Keyword Research and Topic Modeling in a Semantic WebKeyword Research and Topic Modeling in a Semantic Web
Keyword Research and Topic Modeling in a Semantic WebBill Slawski
 
Canonicalization for SEO BrightonSEO April 2023 Patrick Stox
Canonicalization for SEO BrightonSEO April 2023 Patrick StoxCanonicalization for SEO BrightonSEO April 2023 Patrick Stox
Canonicalization for SEO BrightonSEO April 2023 Patrick StoxAhrefs
 
Lexical Semantics, Semantic Similarity and Relevance for SEO
Lexical Semantics, Semantic Similarity and Relevance for SEOLexical Semantics, Semantic Similarity and Relevance for SEO
Lexical Semantics, Semantic Similarity and Relevance for SEOKoray Tugberk GUBUR
 
Probabilistic Thinking in SEO - BrightonSEO October 2022
Probabilistic Thinking in SEO - BrightonSEO October 2022Probabilistic Thinking in SEO - BrightonSEO October 2022
Probabilistic Thinking in SEO - BrightonSEO October 2022Andrew Charlton
 
BrightonSEO - Master Crawl Budget Optimization for Enterprise Websites
BrightonSEO - Master Crawl Budget Optimization for Enterprise WebsitesBrightonSEO - Master Crawl Budget Optimization for Enterprise Websites
BrightonSEO - Master Crawl Budget Optimization for Enterprise WebsitesManick Bhan
 
Web Server SEO: Make your TTFB faster!
Web Server SEO: Make your TTFB faster!Web Server SEO: Make your TTFB faster!
Web Server SEO: Make your TTFB faster!Ash New
 
SEO & Patents Vrtualcon v. 3.0
SEO & Patents Vrtualcon v. 3.0SEO & Patents Vrtualcon v. 3.0
SEO & Patents Vrtualcon v. 3.0Bill Slawski
 
BrightonSEO April 2022 - Kara Thurkettle - Search in the Metaverse.pdf
BrightonSEO April 2022 - Kara Thurkettle - Search in the Metaverse.pdfBrightonSEO April 2022 - Kara Thurkettle - Search in the Metaverse.pdf
BrightonSEO April 2022 - Kara Thurkettle - Search in the Metaverse.pdf🇺🇲 🇬🇧 Kara Thurkettle
 
AI-powered Semantic SEO by Koray GUBUR
AI-powered Semantic SEO by Koray GUBURAI-powered Semantic SEO by Koray GUBUR
AI-powered Semantic SEO by Koray GUBURAnton Shulke
 
Negotiating crawl budget with googlebots
Negotiating crawl budget with googlebotsNegotiating crawl budget with googlebots
Negotiating crawl budget with googlebotsDawn Anderson MSc DigM
 
Brighton SEO April 2022 - Automate the technical SEO stuff
Brighton SEO April 2022 - Automate the technical SEO stuffBrighton SEO April 2022 - Automate the technical SEO stuff
Brighton SEO April 2022 - Automate the technical SEO stuffMichael Van Den Reym
 

Was ist angesagt? (20)

Natural Semantic SEO - Surfacing Walnuts in Densely Represented, Every Increa...
Natural Semantic SEO - Surfacing Walnuts in Densely Represented, Every Increa...Natural Semantic SEO - Surfacing Walnuts in Densely Represented, Every Increa...
Natural Semantic SEO - Surfacing Walnuts in Densely Represented, Every Increa...
 
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
 
Kleecks - AI-Martech as a game changer-DEF.pdf
Kleecks - AI-Martech as a game changer-DEF.pdfKleecks - AI-Martech as a game changer-DEF.pdf
Kleecks - AI-Martech as a game changer-DEF.pdf
 
BrightonSEO - Apr 2022 - No excuses for doing UX
BrightonSEO - Apr 2022 - No excuses for doing UXBrightonSEO - Apr 2022 - No excuses for doing UX
BrightonSEO - Apr 2022 - No excuses for doing UX
 
Search Query Processing: The Secret Life of Queries, Parsing, Rewriting & SEO
Search Query Processing: The Secret Life of Queries, Parsing, Rewriting & SEOSearch Query Processing: The Secret Life of Queries, Parsing, Rewriting & SEO
Search Query Processing: The Secret Life of Queries, Parsing, Rewriting & SEO
 
Data Studio for SEOs: Reporting Automation Tips - Weekly SEO with Lazarina Stoy
Data Studio for SEOs: Reporting Automation Tips - Weekly SEO with Lazarina StoyData Studio for SEOs: Reporting Automation Tips - Weekly SEO with Lazarina Stoy
Data Studio for SEOs: Reporting Automation Tips - Weekly SEO with Lazarina Stoy
 
Keyword Research and Topic Modeling in a Semantic Web
Keyword Research and Topic Modeling in a Semantic WebKeyword Research and Topic Modeling in a Semantic Web
Keyword Research and Topic Modeling in a Semantic Web
 
Canonicalization for SEO BrightonSEO April 2023 Patrick Stox
Canonicalization for SEO BrightonSEO April 2023 Patrick StoxCanonicalization for SEO BrightonSEO April 2023 Patrick Stox
Canonicalization for SEO BrightonSEO April 2023 Patrick Stox
 
Lexical Semantics, Semantic Similarity and Relevance for SEO
Lexical Semantics, Semantic Similarity and Relevance for SEOLexical Semantics, Semantic Similarity and Relevance for SEO
Lexical Semantics, Semantic Similarity and Relevance for SEO
 
Entity seo
Entity seoEntity seo
Entity seo
 
Probabilistic Thinking in SEO - BrightonSEO October 2022
Probabilistic Thinking in SEO - BrightonSEO October 2022Probabilistic Thinking in SEO - BrightonSEO October 2022
Probabilistic Thinking in SEO - BrightonSEO October 2022
 
BrightonSEO - Master Crawl Budget Optimization for Enterprise Websites
BrightonSEO - Master Crawl Budget Optimization for Enterprise WebsitesBrightonSEO - Master Crawl Budget Optimization for Enterprise Websites
BrightonSEO - Master Crawl Budget Optimization for Enterprise Websites
 
Log File Analysis
Log File AnalysisLog File Analysis
Log File Analysis
 
Web Server SEO: Make your TTFB faster!
Web Server SEO: Make your TTFB faster!Web Server SEO: Make your TTFB faster!
Web Server SEO: Make your TTFB faster!
 
SEO & Patents Vrtualcon v. 3.0
SEO & Patents Vrtualcon v. 3.0SEO & Patents Vrtualcon v. 3.0
SEO & Patents Vrtualcon v. 3.0
 
BrightonSEO April 2022 - Kara Thurkettle - Search in the Metaverse.pdf
BrightonSEO April 2022 - Kara Thurkettle - Search in the Metaverse.pdfBrightonSEO April 2022 - Kara Thurkettle - Search in the Metaverse.pdf
BrightonSEO April 2022 - Kara Thurkettle - Search in the Metaverse.pdf
 
AI-powered Semantic SEO by Koray GUBUR
AI-powered Semantic SEO by Koray GUBURAI-powered Semantic SEO by Koray GUBUR
AI-powered Semantic SEO by Koray GUBUR
 
Negotiating crawl budget with googlebots
Negotiating crawl budget with googlebotsNegotiating crawl budget with googlebots
Negotiating crawl budget with googlebots
 
40 Deep #SEO Insights for 2023
40 Deep #SEO Insights for 202340 Deep #SEO Insights for 2023
40 Deep #SEO Insights for 2023
 
Brighton SEO April 2022 - Automate the technical SEO stuff
Brighton SEO April 2022 - Automate the technical SEO stuffBrighton SEO April 2022 - Automate the technical SEO stuff
Brighton SEO April 2022 - Automate the technical SEO stuff
 

Ähnlich wie 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
 

Ähnlich wie 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分享
 

Mehr von 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
 

Mehr von 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
 

Kürzlich hochgeladen

15 Tactics to Scale Your Trade Show Marketing Strategy
15 Tactics to Scale Your Trade Show Marketing Strategy15 Tactics to Scale Your Trade Show Marketing Strategy
15 Tactics to Scale Your Trade Show Marketing StrategyBlue Atlas Marketing
 
2024 WTF - what's working in mobile user acquisition
2024 WTF - what's working in mobile user acquisition2024 WTF - what's working in mobile user acquisition
2024 WTF - what's working in mobile user acquisitionJohn Koetsier
 
Codes and Conventions of Film Magazine Covers.pptx
Codes and Conventions of Film Magazine Covers.pptxCodes and Conventions of Film Magazine Covers.pptx
Codes and Conventions of Film Magazine Covers.pptxGeorgeCulica
 
TAM Sports IPL 17 Advertising Report- M01 - M23
TAM Sports IPL 17 Advertising Report- M01 - M23TAM Sports IPL 17 Advertising Report- M01 - M23
TAM Sports IPL 17 Advertising Report- M01 - M23Social Samosa
 
Miss Immigrant USA Activity Pageant Program.pdf
Miss Immigrant USA Activity Pageant Program.pdfMiss Immigrant USA Activity Pageant Program.pdf
Miss Immigrant USA Activity Pageant Program.pdfMagdalena Kulisz
 
Gen Z and Millennial Debit Card Use Survey.pdf
Gen Z and Millennial Debit Card Use Survey.pdfGen Z and Millennial Debit Card Use Survey.pdf
Gen Z and Millennial Debit Card Use Survey.pdfMedia Logic
 
Exploring Web 3.0 Growth marketing: Navigating the Future of the Internet
Exploring Web 3.0 Growth marketing: Navigating the Future of the InternetExploring Web 3.0 Growth marketing: Navigating the Future of the Internet
Exploring Web 3.0 Growth marketing: Navigating the Future of the Internetnehapardhi711
 
Master the art of Social Selling to increase sales by fostering relationships...
Master the art of Social Selling to increase sales by fostering relationships...Master the art of Social Selling to increase sales by fostering relationships...
Master the art of Social Selling to increase sales by fostering relationships...VereigenMedia1
 
Content Marketing: How To Find The True Value Of Your Marketing Funnel
Content Marketing: How To Find The True Value Of Your Marketing FunnelContent Marketing: How To Find The True Value Of Your Marketing Funnel
Content Marketing: How To Find The True Value Of Your Marketing FunnelSearch Engine Journal
 
SEO Forecasting by Nitin Manchanda at Berlin SEO & Content Club
SEO Forecasting by Nitin Manchanda at Berlin SEO & Content ClubSEO Forecasting by Nitin Manchanda at Berlin SEO & Content Club
SEO Forecasting by Nitin Manchanda at Berlin SEO & Content ClubNitin Manchanda
 
Navigating Global Markets and Strategies for Success
Navigating Global Markets and Strategies for SuccessNavigating Global Markets and Strategies for Success
Navigating Global Markets and Strategies for SuccessElizabeth Moore
 
Agencia Marketing Branding Measurement Certification Google Ads Abril 2024
Agencia Marketing Branding Measurement Certification Google Ads Abril 2024Agencia Marketing Branding Measurement Certification Google Ads Abril 2024
Agencia Marketing Branding Measurement Certification Google Ads Abril 2024Marketing BRANDING
 
Professional Sales Representative by Sahil Srivastava.pptx
Professional Sales Representative by Sahil Srivastava.pptxProfessional Sales Representative by Sahil Srivastava.pptx
Professional Sales Representative by Sahil Srivastava.pptxSahil Srivastava
 
Understand the Key differences between SMO and SMM
Understand the Key differences between SMO and SMMUnderstand the Key differences between SMO and SMM
Understand the Key differences between SMO and SMMsearchextensionin
 
8 distribution in rural mkts.ppt Rural Marketing
8 distribution in rural mkts.ppt Rural Marketing8 distribution in rural mkts.ppt Rural Marketing
8 distribution in rural mkts.ppt Rural Marketingpshirsat
 
Creating a Successful Digital Marketing Campaign.pdf
Creating a Successful Digital Marketing Campaign.pdfCreating a Successful Digital Marketing Campaign.pdf
Creating a Successful Digital Marketing Campaign.pdfgopzzzin
 
20 Top Social Media Tips for Peer Specialists
20 Top Social Media Tips for Peer Specialists20 Top Social Media Tips for Peer Specialists
20 Top Social Media Tips for Peer Specialistsmlicam615
 
2024's Top PPC Tactics: Triple Your Google Ads Local Leads
2024's Top PPC Tactics: Triple Your Google Ads Local Leads2024's Top PPC Tactics: Triple Your Google Ads Local Leads
2024's Top PPC Tactics: Triple Your Google Ads Local LeadsSearch Engine Journal
 
Ryanair Marketing and business development Plan
Ryanair Marketing and business development  PlanRyanair Marketing and business development  Plan
Ryanair Marketing and business development Plandrkarimsaber
 
The power of SEO-driven market intelligence
The power of SEO-driven market intelligenceThe power of SEO-driven market intelligence
The power of SEO-driven market intelligenceHinde Lamrani
 

Kürzlich hochgeladen (20)

15 Tactics to Scale Your Trade Show Marketing Strategy
15 Tactics to Scale Your Trade Show Marketing Strategy15 Tactics to Scale Your Trade Show Marketing Strategy
15 Tactics to Scale Your Trade Show Marketing Strategy
 
2024 WTF - what's working in mobile user acquisition
2024 WTF - what's working in mobile user acquisition2024 WTF - what's working in mobile user acquisition
2024 WTF - what's working in mobile user acquisition
 
Codes and Conventions of Film Magazine Covers.pptx
Codes and Conventions of Film Magazine Covers.pptxCodes and Conventions of Film Magazine Covers.pptx
Codes and Conventions of Film Magazine Covers.pptx
 
TAM Sports IPL 17 Advertising Report- M01 - M23
TAM Sports IPL 17 Advertising Report- M01 - M23TAM Sports IPL 17 Advertising Report- M01 - M23
TAM Sports IPL 17 Advertising Report- M01 - M23
 
Miss Immigrant USA Activity Pageant Program.pdf
Miss Immigrant USA Activity Pageant Program.pdfMiss Immigrant USA Activity Pageant Program.pdf
Miss Immigrant USA Activity Pageant Program.pdf
 
Gen Z and Millennial Debit Card Use Survey.pdf
Gen Z and Millennial Debit Card Use Survey.pdfGen Z and Millennial Debit Card Use Survey.pdf
Gen Z and Millennial Debit Card Use Survey.pdf
 
Exploring Web 3.0 Growth marketing: Navigating the Future of the Internet
Exploring Web 3.0 Growth marketing: Navigating the Future of the InternetExploring Web 3.0 Growth marketing: Navigating the Future of the Internet
Exploring Web 3.0 Growth marketing: Navigating the Future of the Internet
 
Master the art of Social Selling to increase sales by fostering relationships...
Master the art of Social Selling to increase sales by fostering relationships...Master the art of Social Selling to increase sales by fostering relationships...
Master the art of Social Selling to increase sales by fostering relationships...
 
Content Marketing: How To Find The True Value Of Your Marketing Funnel
Content Marketing: How To Find The True Value Of Your Marketing FunnelContent Marketing: How To Find The True Value Of Your Marketing Funnel
Content Marketing: How To Find The True Value Of Your Marketing Funnel
 
SEO Forecasting by Nitin Manchanda at Berlin SEO & Content Club
SEO Forecasting by Nitin Manchanda at Berlin SEO & Content ClubSEO Forecasting by Nitin Manchanda at Berlin SEO & Content Club
SEO Forecasting by Nitin Manchanda at Berlin SEO & Content Club
 
Navigating Global Markets and Strategies for Success
Navigating Global Markets and Strategies for SuccessNavigating Global Markets and Strategies for Success
Navigating Global Markets and Strategies for Success
 
Agencia Marketing Branding Measurement Certification Google Ads Abril 2024
Agencia Marketing Branding Measurement Certification Google Ads Abril 2024Agencia Marketing Branding Measurement Certification Google Ads Abril 2024
Agencia Marketing Branding Measurement Certification Google Ads Abril 2024
 
Professional Sales Representative by Sahil Srivastava.pptx
Professional Sales Representative by Sahil Srivastava.pptxProfessional Sales Representative by Sahil Srivastava.pptx
Professional Sales Representative by Sahil Srivastava.pptx
 
Understand the Key differences between SMO and SMM
Understand the Key differences between SMO and SMMUnderstand the Key differences between SMO and SMM
Understand the Key differences between SMO and SMM
 
8 distribution in rural mkts.ppt Rural Marketing
8 distribution in rural mkts.ppt Rural Marketing8 distribution in rural mkts.ppt Rural Marketing
8 distribution in rural mkts.ppt Rural Marketing
 
Creating a Successful Digital Marketing Campaign.pdf
Creating a Successful Digital Marketing Campaign.pdfCreating a Successful Digital Marketing Campaign.pdf
Creating a Successful Digital Marketing Campaign.pdf
 
20 Top Social Media Tips for Peer Specialists
20 Top Social Media Tips for Peer Specialists20 Top Social Media Tips for Peer Specialists
20 Top Social Media Tips for Peer Specialists
 
2024's Top PPC Tactics: Triple Your Google Ads Local Leads
2024's Top PPC Tactics: Triple Your Google Ads Local Leads2024's Top PPC Tactics: Triple Your Google Ads Local Leads
2024's Top PPC Tactics: Triple Your Google Ads Local Leads
 
Ryanair Marketing and business development Plan
Ryanair Marketing and business development  PlanRyanair Marketing and business development  Plan
Ryanair Marketing and business development Plan
 
The power of SEO-driven market intelligence
The power of SEO-driven market intelligenceThe power of SEO-driven market intelligence
The power of SEO-driven market intelligence
 

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