【Vol.1】How to Get Started with Google Colab – A Beginner’s Guide to the Python Execution Environment (with Screenshots)

未分類

There are several options for Python development environments, but I first started with
Google Colaboratory (Colab) because it’s so easy to get started.
In this article, I’ll walk you through preparing your Google account and Google Drive, and show you how to run Python in Colab with screenshots.

I’m still learning myself, but I hope this helps those just starting out.
[Personal Experience] I thought setting up an environment would take ages, but I was amazed to have Python running in just five minutes with Colab.

To begin with Python, there are three main methods: “Google Colab,” “Anaconda (Jupyter Notebook),” and “Direct Installation.”

I was unsure which to choose at first, so I’ve summarized this for anyone in the same situation.
[Failure Story] I installed Anaconda, but it was so large that my PC slowed down, so I eventually switched to Colab.

* Note: I’ve also included some beginner-friendly notes.

Environment Advantages Disadvantages
Google Colab
(Runs in the browser)
★ Recommended for Beginners
• No installation required—just open your browser and go
• Free GPU access (※1)
• Easy integration with Google Drive
• Jupyter Notebook format works well with online tutorials
• Requires an internet connection
[Personal Experience] I panicked when the Wi-Fi dropped in a café.
• Sessions automatically end after 12 hours (※2)
[Failure Story] I lost unsaved data when my session disconnected mid-work—remember to save often!
• Limited for advanced customizations or local connections
Anaconda (Jupyter)
(Installed on your PC)
• Comes with a rich set of libraries pre-installed
• Works offline
• GUI tools make virtual environment (env) management easy
• Large initial download size (3–5 GB)
[Personal Experience] It took over an hour to install—mind your storage!
• Performance depends on your PC (especially for GPU tasks)
• Unused environments can hog disk space
Direct Installation
(From the official Python distribution)
• Lightweight—install only what you need
• Highly customizable environment
• A professional setup favored by engineers
• Slightly advanced for beginners (※3)
• Requires familiarity with virtual environments (venv, pyenv, etc.)
• You’re responsible for managing libraries and troubleshooting

※1: Even the free Colab plan lets you switch your runtime to GPU, but usage time is limited.
※2: Sessions disconnect automatically after a set time, so it’s not ideal for long-running tasks (extended time is available in Pro).
※3: Geared toward those familiar with Python and system internals. Beginners should start with Colab or Anaconda.

How to Use Google Colab (Step-by-Step)

Step 1: Create a Google Account

To use Google Colab, you need a Google account. If you don’t have one yet, create one here.

[Personal Experience] I set up a dedicated sub-account for learning, and data management became much easier.

Step 2: Access Google Drive

Log in to Google Drive, where your Colab notebooks will be saved.

Google Drive screen

Step 3: Launch Colab from Google Drive

Click “+ New” → “More” → “Google Colaboratory” in the Google Drive menu.

[Failure Story] I couldn’t find Colab at first, but adding the Chrome extension made it appear.

Google Colaboratory launch screen

Step 4: Colab Notebook Interface

When Colab launches, you’ll see the notebook interface. Enter code into cells and run them instantly.

Step 5: Run Your First Python Code

Type 1 + 1 in a cell and press “Shift + Enter” to see 2 below.

[Personal Experience] I still remember the thrill of running “1 + 1” and seeing Python work under my hands.

Python code execution image

Step 6: Use for Data Analysis and Learning

Colab is Jupyter-compatible, so you can immediately import and use libraries like pandas and NumPy.

[Failure Story] I forgot to import libraries and got errors—make it a habit to write your import statements first.

🔰 What Are pandas and NumPy? (Beginner Notes)

Two essential libraries for Python data analysis are pandas and NumPy.
Here’s a quick beginner overview of their roles.

  • pandas:
    A library for handling tabular data (like Excel).
    You can easily read, manipulate, aggregate, and filter data.
    Example: Load a CSV file and extract only the rows you need.
  • NumPy:
    A library specialized in numerical computations, handling vectors and matrices at high speed.
    pandas uses NumPy under the hood, making it foundational for data analysis.
    Example: Perform statistical operations or basic machine learning on large numerical datasets.

In Google Colab, you import them like this:

import pandas as pd
import numpy as np

This assigns the aliases pd and np to each library for convenience.
This aliasing convention is used in most tutorials and books.

If it feels unfamiliar, don’t worry.
It’s enough to know these names for now.
We’ll dive deeper into these libraries in future posts.

✅ Summary

  • There are three main Python environments: Colab, Anaconda, and direct installation.
  • Google Colab offers browser-only convenience, making it ideal for beginners.
  • Anaconda is suited for comprehensive analysis and development setups.
  • Direct Installation provides maximum flexibility but is better for intermediate to advanced users.
  • Start with Colab to build confidence, then advance to other environments.

[Summary Experience] Even though I was hesitant at first, Colab lowered the barrier to learning Python.

▲ Back to Top

コメント

Copied title and URL