Google Colab for SEO: How to get started

Date:


Google Colab has been around since 2017 but has gained more popularity recently from SEO professionals sharing code samples. 

SEOs love Colab because, unlike GitHub, you can actually run the code directly on the platform.

What is Google Colab?

Google Colab is a tool that allows users to quickly run Python directly on the platform with little to no setup. Google Colab is a hosted Jupyter Notebook that uses Google’s hosting services in the cloud.

In case you’re new to Python, a Jupyter Notebook is a free online tool you can use online to write code, solve math problems, make graphs and show your work. It’s like a digital notebook that helps you keep all of your project parts in one place and share them easily with others.

The best part about Google Colab? It’s free.

If you require more computing power, there is a tier pricing system. As of writing this, I pay $9.99 per month for the first paid tier. The next tier is $49.99 per month and then there’s a custom enterprise version.

Benefits of Google Colab

I’ve personally reaped the benefits of Google Colab for several years and am pleased to share what I’ve found to be its biggest benefits for SEOs. 

Fast to start

If you’ve ever installed Python on your local machine, then you know firsthand how annoying it is to get Python set up. Also, if you’re trying a new bit of code, then you’re likely having to install new libraries to get your code to run. 

The best part about Google Colab is that most common Python libraries are already installed on Google Colab. If something is missing, you can simply run:

!pip install new-library

The one nuance here is that you need the exclamation point before pip to install a new library. 

Doesn’t use your computer’s bandwidth

I often use Python to compute large datasets, which can take quite a bit of time. I’ve run some bits of code that take hours to compute due to the size of the data. 

In SEO, we often run crawls and other analyses in the background while we work. Have you ever run a Screaming Frog crawl that completely slows down your computer, making it nearly impossible to do other SEO tasks?

With Google Colab, you can seamlessly run compute-intensive code and work on other SEO tasks while the code runs.

Shareable

Google Colab is meant to be easily shared with collaborators or the world. As someone who believes in the power of open source, I believe that Google Colab is great for me to share code with the SEO community.

AI integration

Google has integrated Gemini directly into Google Colab. So, if you’re struggling to build a new feature in your code, you can leverage AI to help generate new code features.

I would urge caution when doing this, as you may find yourself debugging more than helping yourself.

Dig deeper: Can AI perform technical SEO analysis effectively?

Get the daily newsletter search marketers rely on.


How to use Google Colab

Let’s dive right into how to use Google Colab. I’ll run you through the eight most important features to get you right to coding for SEO.

How to run code

Probably the most simple step here is to know how to actually run the code.

Once you’re ready to run your code, click the play button. 

How to run codeHow to run code

How to open the folder pane

To run code that relies on any source data or exports results into a file, you’ll need to be able to open the folder. Luckily, just like running code, this is just one button, specifically the one that looks like a folder.

How to open the folder paneHow to open the folder pane

How to connect to Google Drive

One of the great things about Google Colab is that it’s part of the Google suite of tools, allowing you to connect directly to files in Google Drive and even save your results to Google Drive.

To connect to Google Drive, you first need to mount It by clicking the button shown in the screenshot below.

How to connect to Google DriveHow to connect to Google Drive

Once Colab finishes mounting Google Drive, your Google Drive folder will appear in the files pane. 

How to connect to Google Drive - MountedHow to connect to Google Drive - Mounted

From here, you’re able to reference any of those files by right-clicking on the file, selecting a copy path and pasting it wherever you reference a file in your code.

How to connect to Google Drive - Copy pathHow to connect to Google Drive - Copy path

How to upload files manually

Before uploading files, note that anything you upload will not be saved and will only be used as temporary files. Those files will disappear once you refresh the page or close it.

If you want the files to stay available, you’ll need to use Google Drive and connect to them that way (see previous steps). 

If you’re OK using files temporarily, then you have two options. You can drag and drop your files from your computer to the files pane or click the upload button.

How to upload files manuallyHow to upload files manually

How to create new files directly in Google Colab

Sometimes, I find it easier to create new files directly in Google Colab.

For example, if I have a bunch of keywords I want to analyze, it’s easier for me to copy them and paste them into a file in Colab rather than create a new file locally on my computer and upload it.

To do this, just right-click on a blank space in the files pane and click New File. From there, you can name it whatever you want, and paste your data and then save it with your hotkeys (Command + S or Control + S).

How to create new files directly in Google ColabHow to create new files directly in Google Colab

How to download results

Once you’ve run the code, you may have an exported file created in the process.

You can preview the file by double-clicking on it, but if you want to download it, all you need to do is right-click on it and select Download.

How to download resultsHow to download results

How to connect to a runtime

If you’re running code that may take a more heavy compute load, you may want to experiment with a faster runtime.

To do this, select Runtime in the top menu and then in the dropdown, select Change runtime type.

From there, you’ll see some options that you can change. 

Please note that if you’re going to change the runtime, any files in the file pane will disappear. 

How to connect to a runtimeHow to connect to a runtime

How to use the AI integration

One of the latest features in Google Colab is the integration of Gemini. Google has made it easy to take advantage of this new feature by adding a Gemini button in the top right of the screen.

By clicking that, a sidebar will appear for you to ask it prompts. 

How to use the AI integrationHow to use the AI integration

Free code to get you started

Now that you’ve taken the crash course to getting started with Google Colab, it’s time to try some code! 

In one of my previous articles, I’ve provided five Python scripts for SEO that you can try right now in Google Colab.

In that article, you will be able to see the context of the scripts, how to set them up and I provide the actual code for you to try.

It’s never been easier to get started in Python for SEO. Happy coding!

Contributing authors are invited to create content for Search Engine Land and are chosen for their expertise and contribution to the search community. Our contributors work under the oversight of the editorial staff and contributions are checked for quality and relevance to our readers. The opinions they express are their own.



Source link

Share post:

[tds_leads title_text="Subscribe" input_placeholder="Email address" btn_horiz_align="content-horiz-center" pp_checkbox="yes" pp_msg="SSd2ZSUyMHJlYWQlMjBhbmQlMjBhY2NlcHQlMjB0aGUlMjAlM0NhJTIwaHJlZiUzRCUyMiUyMyUyMiUzRVByaXZhY3klMjBQb2xpY3klM0MlMkZhJTNFLg==" f_title_font_family="653" f_title_font_size="eyJhbGwiOiIyNCIsInBvcnRyYWl0IjoiMjAiLCJsYW5kc2NhcGUiOiIyMiJ9" f_title_font_line_height="1" f_title_font_weight="700" f_title_font_spacing="-1" msg_composer="success" display="column" gap="10" input_padd="eyJhbGwiOiIxNXB4IDEwcHgiLCJsYW5kc2NhcGUiOiIxMnB4IDhweCIsInBvcnRyYWl0IjoiMTBweCA2cHgifQ==" input_border="1" btn_text="I want in" btn_tdicon="tdc-font-tdmp tdc-font-tdmp-arrow-right" btn_icon_size="eyJhbGwiOiIxOSIsImxhbmRzY2FwZSI6IjE3IiwicG9ydHJhaXQiOiIxNSJ9" btn_icon_space="eyJhbGwiOiI1IiwicG9ydHJhaXQiOiIzIn0=" btn_radius="3" input_radius="3" f_msg_font_family="653" f_msg_font_size="eyJhbGwiOiIxMyIsInBvcnRyYWl0IjoiMTIifQ==" f_msg_font_weight="600" f_msg_font_line_height="1.4" f_input_font_family="653" f_input_font_size="eyJhbGwiOiIxNCIsImxhbmRzY2FwZSI6IjEzIiwicG9ydHJhaXQiOiIxMiJ9" f_input_font_line_height="1.2" f_btn_font_family="653" f_input_font_weight="500" f_btn_font_size="eyJhbGwiOiIxMyIsImxhbmRzY2FwZSI6IjEyIiwicG9ydHJhaXQiOiIxMSJ9" f_btn_font_line_height="1.2" f_btn_font_weight="700" f_pp_font_family="653" f_pp_font_size="eyJhbGwiOiIxMyIsImxhbmRzY2FwZSI6IjEyIiwicG9ydHJhaXQiOiIxMSJ9" f_pp_font_line_height="1.2" pp_check_color="#000000" pp_check_color_a="#ec3535" pp_check_color_a_h="#c11f1f" f_btn_font_transform="uppercase" tdc_css="eyJhbGwiOnsibWFyZ2luLWJvdHRvbSI6IjQwIiwiZGlzcGxheSI6IiJ9LCJsYW5kc2NhcGUiOnsibWFyZ2luLWJvdHRvbSI6IjM1IiwiZGlzcGxheSI6IiJ9LCJsYW5kc2NhcGVfbWF4X3dpZHRoIjoxMTQwLCJsYW5kc2NhcGVfbWluX3dpZHRoIjoxMDE5LCJwb3J0cmFpdCI6eyJtYXJnaW4tYm90dG9tIjoiMzAiLCJkaXNwbGF5IjoiIn0sInBvcnRyYWl0X21heF93aWR0aCI6MTAxOCwicG9ydHJhaXRfbWluX3dpZHRoIjo3Njh9" msg_succ_radius="2" btn_bg="#ec3535" btn_bg_h="#c11f1f" title_space="eyJwb3J0cmFpdCI6IjEyIiwibGFuZHNjYXBlIjoiMTQiLCJhbGwiOiIxOCJ9" msg_space="eyJsYW5kc2NhcGUiOiIwIDAgMTJweCJ9" btn_padd="eyJsYW5kc2NhcGUiOiIxMiIsInBvcnRyYWl0IjoiMTBweCJ9" msg_padd="eyJwb3J0cmFpdCI6IjZweCAxMHB4In0="]
spot_imgspot_img

Popular

More like this
Related

I Asked 3 Food Experts To Name the Best Hand Mixer—They All Said the Same Brand

While a good stand mixer can help...

test – Travel Dudes

Science for True Well-Being | Scientific American

November 27, 20243 min readScience for True Well-BeingThe...

Dogster Photo Contest: Dogs of the Week Winners (November 28, 2024)

The post Dogster Photo Contest: Dogs of the...