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?

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
 
Coronavirus and Future of SEO: Digital Marketing and Remote Culture
Coronavirus and Future of SEO: Digital Marketing and Remote CultureCoronavirus and Future of SEO: Digital Marketing and Remote Culture
Coronavirus and Future of SEO: Digital Marketing and Remote CultureKoray Tugberk GUBUR
 
Crawling, indexation & the impact on performance | Brighton SEO
Crawling, indexation & the impact on performance | Brighton SEOCrawling, indexation & the impact on performance | Brighton SEO
Crawling, indexation & the impact on performance | Brighton SEOMartin Sean Fennon
 
Opinion-based Article Ranking for Information Retrieval Systems: Factoids and...
Opinion-based Article Ranking for Information Retrieval Systems: Factoids and...Opinion-based Article Ranking for Information Retrieval Systems: Factoids and...
Opinion-based Article Ranking for Information Retrieval Systems: Factoids and...Koray Tugberk GUBUR
 
How Search Works
How Search WorksHow Search Works
How Search WorksAhrefs
 
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
 
A beginner's guide to machine learning for SEOs - WTSFest 2022
A beginner's guide to machine learning for SEOs  - WTSFest 2022A beginner's guide to machine learning for SEOs  - WTSFest 2022
A beginner's guide to machine learning for SEOs - WTSFest 2022LazarinaStoyanova
 
SMX Session - State of Search 2023
SMX Session - State of Search 2023SMX Session - State of Search 2023
SMX Session - State of Search 2023Marcus Tober
 
PubCon, Lazarina Stoy. - Machine Learning in Search: Google's ML APIs vs Open...
PubCon, Lazarina Stoy. - Machine Learning in Search: Google's ML APIs vs Open...PubCon, Lazarina Stoy. - Machine Learning in Search: Google's ML APIs vs Open...
PubCon, Lazarina Stoy. - Machine Learning in Search: Google's ML APIs vs Open...LazarinaStoyanova
 
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
 
Disambiguating Equiprobability in SEO Dawn Anderson Friends of Search 2020
Disambiguating Equiprobability in SEO Dawn Anderson Friends of Search 2020Disambiguating Equiprobability in SEO Dawn Anderson Friends of Search 2020
Disambiguating Equiprobability in SEO Dawn Anderson Friends of Search 2020Dawn Anderson MSc DigM
 
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
 
Semantic Search Engine: Semantic Search and Query Parsing with Phrases and En...
Semantic Search Engine: Semantic Search and Query Parsing with Phrases and En...Semantic Search Engine: Semantic Search and Query Parsing with Phrases and En...
Semantic Search Engine: Semantic Search and Query Parsing with Phrases and En...Koray Tugberk GUBUR
 
How to Incorporate ML in your SERP Analysis, Lazarina Stoy -BrightonSEO Oct, ...
How to Incorporate ML in your SERP Analysis, Lazarina Stoy -BrightonSEO Oct, ...How to Incorporate ML in your SERP Analysis, Lazarina Stoy -BrightonSEO Oct, ...
How to Incorporate ML in your SERP Analysis, Lazarina Stoy -BrightonSEO Oct, ...LazarinaStoyanova
 
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
 
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
 
[BrightonSEO 2019] Restructuring Websites to Improve Indexability
[BrightonSEO 2019] Restructuring Websites to Improve Indexability[BrightonSEO 2019] Restructuring Websites to Improve Indexability
[BrightonSEO 2019] Restructuring Websites to Improve IndexabilityAreej AbuAli
 
The Big SEO Migration - Learnings from a first time hiker
The Big SEO Migration - Learnings from a first time hiker The Big SEO Migration - Learnings from a first time hiker
The Big SEO Migration - Learnings from a first time hiker ReneHarris7
 

Was ist angesagt? (20)

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
 
Coronavirus and Future of SEO: Digital Marketing and Remote Culture
Coronavirus and Future of SEO: Digital Marketing and Remote CultureCoronavirus and Future of SEO: Digital Marketing and Remote Culture
Coronavirus and Future of SEO: Digital Marketing and Remote Culture
 
Crawling, indexation & the impact on performance | Brighton SEO
Crawling, indexation & the impact on performance | Brighton SEOCrawling, indexation & the impact on performance | Brighton SEO
Crawling, indexation & the impact on performance | Brighton SEO
 
Opinion-based Article Ranking for Information Retrieval Systems: Factoids and...
Opinion-based Article Ranking for Information Retrieval Systems: Factoids and...Opinion-based Article Ranking for Information Retrieval Systems: Factoids and...
Opinion-based Article Ranking for Information Retrieval Systems: Factoids and...
 
40 Deep #SEO Insights for 2023
40 Deep #SEO Insights for 202340 Deep #SEO Insights for 2023
40 Deep #SEO Insights for 2023
 
How Search Works
How Search WorksHow Search Works
How Search Works
 
Python for SEO
Python for SEOPython for SEO
Python for SEO
 
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
 
A beginner's guide to machine learning for SEOs - WTSFest 2022
A beginner's guide to machine learning for SEOs  - WTSFest 2022A beginner's guide to machine learning for SEOs  - WTSFest 2022
A beginner's guide to machine learning for SEOs - WTSFest 2022
 
SMX Session - State of Search 2023
SMX Session - State of Search 2023SMX Session - State of Search 2023
SMX Session - State of Search 2023
 
PubCon, Lazarina Stoy. - Machine Learning in Search: Google's ML APIs vs Open...
PubCon, Lazarina Stoy. - Machine Learning in Search: Google's ML APIs vs Open...PubCon, Lazarina Stoy. - Machine Learning in Search: Google's ML APIs vs Open...
PubCon, Lazarina Stoy. - Machine Learning in Search: Google's ML APIs vs Open...
 
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?
 
Disambiguating Equiprobability in SEO Dawn Anderson Friends of Search 2020
Disambiguating Equiprobability in SEO Dawn Anderson Friends of Search 2020Disambiguating Equiprobability in SEO Dawn Anderson Friends of Search 2020
Disambiguating Equiprobability in SEO Dawn Anderson Friends of Search 2020
 
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
 
Semantic Search Engine: Semantic Search and Query Parsing with Phrases and En...
Semantic Search Engine: Semantic Search and Query Parsing with Phrases and En...Semantic Search Engine: Semantic Search and Query Parsing with Phrases and En...
Semantic Search Engine: Semantic Search and Query Parsing with Phrases and En...
 
How to Incorporate ML in your SERP Analysis, Lazarina Stoy -BrightonSEO Oct, ...
How to Incorporate ML in your SERP Analysis, Lazarina Stoy -BrightonSEO Oct, ...How to Incorporate ML in your SERP Analysis, Lazarina Stoy -BrightonSEO Oct, ...
How to Incorporate ML in your SERP Analysis, Lazarina Stoy -BrightonSEO Oct, ...
 
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
 
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
 
[BrightonSEO 2019] Restructuring Websites to Improve Indexability
[BrightonSEO 2019] Restructuring Websites to Improve Indexability[BrightonSEO 2019] Restructuring Websites to Improve Indexability
[BrightonSEO 2019] Restructuring Websites to Improve Indexability
 
The Big SEO Migration - Learnings from a first time hiker
The Big SEO Migration - Learnings from a first time hiker The Big SEO Migration - Learnings from a first time hiker
The Big SEO Migration - Learnings from a first time hiker
 

Ä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
 
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
 
White Hat Cloaking
White Hat CloakingWhite Hat Cloaking
White Hat Cloaking
 

Kürzlich hochgeladen

FULL ENJOY Call Girls In Majnu.Ka.Tilla Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Majnu.Ka.Tilla Delhi Contact Us 8377877756FULL ENJOY Call Girls In Majnu.Ka.Tilla Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Majnu.Ka.Tilla Delhi Contact Us 8377877756dollysharma2066
 
Labour Day Celebrating Workers and Their Contributions.pptx
Labour Day Celebrating Workers and Their Contributions.pptxLabour Day Celebrating Workers and Their Contributions.pptx
Labour Day Celebrating Workers and Their Contributions.pptxelizabethella096
 
Major SEO Trends in 2024 - Banyanbrain Digital
Major SEO Trends in 2024 - Banyanbrain DigitalMajor SEO Trends in 2024 - Banyanbrain Digital
Major SEO Trends in 2024 - Banyanbrain DigitalBanyanbrain
 
Social media, ppt. Features, characteristics
Social media, ppt. Features, characteristicsSocial media, ppt. Features, characteristics
Social media, ppt. Features, characteristicswasim792942
 
How to utilize calculated properties in your HubSpot setups
How to utilize calculated properties in your HubSpot setupsHow to utilize calculated properties in your HubSpot setups
How to utilize calculated properties in your HubSpot setupsssuser4571da
 
BDSM⚡Call Girls in Sector 128 Noida Escorts >༒8448380779 Escort Service
BDSM⚡Call Girls in Sector 128 Noida Escorts >༒8448380779 Escort ServiceBDSM⚡Call Girls in Sector 128 Noida Escorts >༒8448380779 Escort Service
BDSM⚡Call Girls in Sector 128 Noida Escorts >༒8448380779 Escort ServiceDelhi Call girls
 
Situation Analysis | Management Company.
Situation Analysis | Management Company.Situation Analysis | Management Company.
Situation Analysis | Management Company.DanielaQuiroz63
 
The+State+of+Careers+In+Retention+Marketing-2.pdf
The+State+of+Careers+In+Retention+Marketing-2.pdfThe+State+of+Careers+In+Retention+Marketing-2.pdf
The+State+of+Careers+In+Retention+Marketing-2.pdfSocial Samosa
 
Brand experience Dream Center Peoria Presentation.pdf
Brand experience Dream Center Peoria Presentation.pdfBrand experience Dream Center Peoria Presentation.pdf
Brand experience Dream Center Peoria Presentation.pdftbatkhuu1
 
What is Google Search Console and What is it provide?
What is Google Search Console and What is it provide?What is Google Search Console and What is it provide?
What is Google Search Console and What is it provide?riteshhsociall
 
Kraft Mac and Cheese campaign presentation
Kraft Mac and Cheese campaign presentationKraft Mac and Cheese campaign presentation
Kraft Mac and Cheese campaign presentationtbatkhuu1
 
Martal Group - B2B Lead Gen Agency - Onboarding Overview
Martal Group - B2B Lead Gen Agency - Onboarding OverviewMartal Group - B2B Lead Gen Agency - Onboarding Overview
Martal Group - B2B Lead Gen Agency - Onboarding OverviewMartal Group
 

Kürzlich hochgeladen (20)

FULL ENJOY Call Girls In Majnu.Ka.Tilla Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Majnu.Ka.Tilla Delhi Contact Us 8377877756FULL ENJOY Call Girls In Majnu.Ka.Tilla Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Majnu.Ka.Tilla Delhi Contact Us 8377877756
 
SEO Master Class - Steve Wiideman, Wiideman Consulting Group
SEO Master Class - Steve Wiideman, Wiideman Consulting GroupSEO Master Class - Steve Wiideman, Wiideman Consulting Group
SEO Master Class - Steve Wiideman, Wiideman Consulting Group
 
Labour Day Celebrating Workers and Their Contributions.pptx
Labour Day Celebrating Workers and Their Contributions.pptxLabour Day Celebrating Workers and Their Contributions.pptx
Labour Day Celebrating Workers and Their Contributions.pptx
 
Navigating the SEO of Tomorrow, Competitive Benchmarking, China as an e-Comme...
Navigating the SEO of Tomorrow, Competitive Benchmarking, China as an e-Comme...Navigating the SEO of Tomorrow, Competitive Benchmarking, China as an e-Comme...
Navigating the SEO of Tomorrow, Competitive Benchmarking, China as an e-Comme...
 
Major SEO Trends in 2024 - Banyanbrain Digital
Major SEO Trends in 2024 - Banyanbrain DigitalMajor SEO Trends in 2024 - Banyanbrain Digital
Major SEO Trends in 2024 - Banyanbrain Digital
 
Social media, ppt. Features, characteristics
Social media, ppt. Features, characteristicsSocial media, ppt. Features, characteristics
Social media, ppt. Features, characteristics
 
How to utilize calculated properties in your HubSpot setups
How to utilize calculated properties in your HubSpot setupsHow to utilize calculated properties in your HubSpot setups
How to utilize calculated properties in your HubSpot setups
 
BDSM⚡Call Girls in Sector 128 Noida Escorts >༒8448380779 Escort Service
BDSM⚡Call Girls in Sector 128 Noida Escorts >༒8448380779 Escort ServiceBDSM⚡Call Girls in Sector 128 Noida Escorts >༒8448380779 Escort Service
BDSM⚡Call Girls in Sector 128 Noida Escorts >༒8448380779 Escort Service
 
Situation Analysis | Management Company.
Situation Analysis | Management Company.Situation Analysis | Management Company.
Situation Analysis | Management Company.
 
Generative AI Master Class - Generative AI, Unleash Creative Opportunity - Pe...
Generative AI Master Class - Generative AI, Unleash Creative Opportunity - Pe...Generative AI Master Class - Generative AI, Unleash Creative Opportunity - Pe...
Generative AI Master Class - Generative AI, Unleash Creative Opportunity - Pe...
 
The Future of Brands on LinkedIn - Alison Kaltman
The Future of Brands on LinkedIn - Alison KaltmanThe Future of Brands on LinkedIn - Alison Kaltman
The Future of Brands on LinkedIn - Alison Kaltman
 
A.I. and The Social Media Shift - Mohit Rajhans
A.I. and The Social Media Shift - Mohit RajhansA.I. and The Social Media Shift - Mohit Rajhans
A.I. and The Social Media Shift - Mohit Rajhans
 
The 100x Factor Growth with AI - Susan Diaz
The 100x Factor  Growth with AI - Susan DiazThe 100x Factor  Growth with AI - Susan Diaz
The 100x Factor Growth with AI - Susan Diaz
 
Generative AI Content Creation - Andrew Jenkins
Generative AI Content Creation - Andrew JenkinsGenerative AI Content Creation - Andrew Jenkins
Generative AI Content Creation - Andrew Jenkins
 
The+State+of+Careers+In+Retention+Marketing-2.pdf
The+State+of+Careers+In+Retention+Marketing-2.pdfThe+State+of+Careers+In+Retention+Marketing-2.pdf
The+State+of+Careers+In+Retention+Marketing-2.pdf
 
Brand experience Dream Center Peoria Presentation.pdf
Brand experience Dream Center Peoria Presentation.pdfBrand experience Dream Center Peoria Presentation.pdf
Brand experience Dream Center Peoria Presentation.pdf
 
What is Google Search Console and What is it provide?
What is Google Search Console and What is it provide?What is Google Search Console and What is it provide?
What is Google Search Console and What is it provide?
 
Kraft Mac and Cheese campaign presentation
Kraft Mac and Cheese campaign presentationKraft Mac and Cheese campaign presentation
Kraft Mac and Cheese campaign presentation
 
Martal Group - B2B Lead Gen Agency - Onboarding Overview
Martal Group - B2B Lead Gen Agency - Onboarding OverviewMartal Group - B2B Lead Gen Agency - Onboarding Overview
Martal Group - B2B Lead Gen Agency - Onboarding Overview
 
How to Create a Social Media Plan Like a Pro - Jordan Scheltgen
How to Create a Social Media Plan Like a Pro - Jordan ScheltgenHow to Create a Social Media Plan Like a Pro - Jordan Scheltgen
How to Create a Social Media Plan Like a Pro - Jordan Scheltgen
 

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