Google Colab: A useful environment for beginners in R or Python programming
A cloud-based environment that allows you to write and run code immediately
Have you tried to install a code editor or an integrated development environment (IDE) on your computer? If you are an absolute beginner with weak computer skills and no programming experience, this can be a frustrating experience.
The installation can involve many steps, which you may struggle to follow.
There can be glitches along the way, and you may not know how to troubleshoot all of them.
Your computer’s operating system may not be fully compatible with the code editor.
You may need to download certain packages to perform your desired tasks, but you don’t know what those packages may be.
Your desired packages may depend on other packages, which complicates the set-up process even further.
The code editor can be overwhelming to an absolute beginner with no guidance. It may have multiple windows, each with a wide array of buttons, and you don’t know what each window or each button is supposed to do.
These challenges can demoralize beginners to the point of giving up on learning how to program altogether, because they have to go through so many obstacles before they write a single line of code.
If you just want to start coding and do not want to deal with these problems, there is an easier way. It is called Google Colab, a cloud-based programming environment from Google, and it is free for you to use with a steady Internet connection. All you need is a Google account1, and you don’t need to download or install anything onto your computer. The following is a screenshot of the first cell from my Google Colab notebook for producing side-by-side box plots.
With Google Colab, beginners can write and execute code in their Internet browser, removing compatibility issues and complex procedures that come with installing code editors on your computer. This frictionless interface lowers the barrier to entry, allowing you to jump straight into coding and learning the core concepts of your programming language.
Google Colab also offers a pre-configured environment that already installed essential packages. For example, I use Python as my main programming language in my job, and I frequently use NumPy, Pandas, Statsmodels, Matplotlib, and Seaborn. In Google Colab, I don’t need to worry about installing these packages; I just need to import them. This eliminates dependency errors and version conflicts common in local set-ups, which are big sources of headaches for many people who first learn to use R or Python. As a statistician, this ready-to-use environment allows me to concentrate on data analysis right away.
Google Colab uses notebooks with distinct cells, which makes it easier for you to learn as you code. You can write a few lines of code in one cell at a time, execute each cell to observe the output, and get immediate feedback about what may be wrong with your code. It also makes it easier for you to organize your code in a logical sequence. Of course, you can choose to execute your code out of order, which allows you to experiment and combine your code to build a larger, coherent script. The text cells enable well-documented tutorials and comments, which will help you to understand your notebooks when you review them in the distant future.
Google Colab provides access to powerful computing resources, including GPUs and TPUs. This is beneficial for those exploring machine learning or data science. Again, Google Colab is free to anyone with a Google account, so this cloud-based availability removes the need for expensive hardware.
Google built a large-language model called Gemini, which is now a feature within Google Colab. You can use Gemini to explain or even generate code for you, and you can upload datasets for it to analyze. Gemini is available for the entire notebook or within each cell; just click on the ✦ character at the top-right of the notebook or each cell. (I don’t recommend you to use Gemini when you first learn to code; you should first grasp the basis syntax and common functions. This will take time and effort, but it is a necessary step toward basic proficiency in a programming language. If you do use Gemini to generate code, you should be able to explain what each line means, rather than treating it as a black box.)
Google has produced a set of curated notebooks to provide examples of how to use Google Colab for various purposes - including data & analytics. I recommend you to explore the one about exploratory data analysis.
Computer programming is an essential skill in data & analytics, but it can be overwhelming to someone who is new to the field. By using Google Colab, I hope that you can enjoy learning how to code and focus on the programming first. As you build comfort with your language of choice, you can eventually choose a code editor that will fit your needs and preferences.
If you are uncomfortable about sharing data with Google for any reason, you can create an account just for computer programming without using its email, calendar, or other services.