What is Google Colab?
What is Google Colab?
Google Colab is a platform that allows users to run Python code directly on the site with minimal setup. Essentially, it’s a cloud-hosted version of Jupyter Notebook, leveraging Google’s cloud services.
For those unfamiliar with Python, a Jupyter Notebook is an online tool that lets you write code, solve mathematical problems, create graphs, and document your process. Think of it as a digital notebook that consolidates all aspects of your project in one place, making it easy to share with others.
The great thing about Google Colab is that it’s free to use. However, if you need more computing power, there are subscription options. Currently, I pay $9.99 per month for the first paid tier. There is also a higher tier at $49.99 per month and a custom enterprise version available.
Benefits of Google Colab
Fast to Start
Setting up Python on your local machine can be a hassle, especially when you need to install new libraries for different projects. Google Colab simplifies this process because most common Python libraries are already installed.
Doesn’t Use Your Computer’s Bandwidth
Running large datasets with Python can be time-consuming and can significantly slow down your computer. In SEO, tasks like running Screaming Frog crawls can make it difficult to perform other tasks on your machine. With Google Colab, you can run compute-intensive code in the cloud without impacting your computer’s performance, allowing you to continue working on other SEO tasks seamlessly.
Shareable
Google Colab is designed for easy sharing with collaborators or the wider community. As an advocate for open source, I find Google Colab to be an excellent platform for sharing code with the SEO community.
AI Integration
Google Colab includes AI integration with Gemini. If you’re struggling to build a new feature in your code, you can leverage AI to help generate new code features, making it easier to develop and enhance your projects.
Overall, Google Colab offers a range of benefits that make it a powerful tool for SEOs and other professionals working with Python
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 simplest 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 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 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.
Once Colab finishes mounting Google Drive, your Google Drive folder will appear in the files pane.
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 Upload Files Manually
Before you upload files, keep in mind that anything you upload manually will be temporary. These files will not be saved and will disappear once you refresh or close the page.
If you need the files to remain accessible, you’ll need to use Google Drive and connect to them as described in previous steps.
For temporary file usage, you have two options:
- Drag and Drop: Simply drag your files from your computer and drop them into the files pane in Google Colab.
- Upload Button: Click the upload button in the files pane and select the files you want to upload from your computer.
Using these methods, you can easily upload files for temporary use in your Google Colab environment.