Google Colab-1 Getting Started, Setting, Connecting to Google Drive, Loading Files

Iden W.
Iden W.
Jan 2 · 5 min read
Photo by William Daigneault on Unsplash

Google Colab is an executable document that lets you write, run, and share code within Google Drive.

Colaboratory, or “Colab” for short, allows you to write and execute Python in your browser, with

- Zero configuration required

- Free access to GPUs

- Easy sharing

Whether you’re a student, a data scientist, or an AI researcher, Colab can make your work easier.

You just click on the New button on the left when you are in Google Drive as shown below.

And then you pass through the menu:

More — — (Scroll down) and click + Connect more apps as shown below.

And then you pass Colaboratory into the search bar and click enter. Now you can install it.

Once you install it, it will appear in the scroll down menu as shown below:

If it doesn’t work, just google it and follow the instructions.

If you’re familiar with the popular Jupyter project, you can think of Colab as a Jupyter notebook stored in Google Drive. A notebook document is composed of cells, each of which can contain code, text, images, and more.

Colab connects your notebook to a cloud-based runtime, meaning you can execute Python code without any required setup on your own machine. For that just go to the connect button on the right and connect to the hosted runtime.

Once you connect, you can see the info on the right pane of your notebook.

Additional code cells are executed using that same runtime, resulting in a rich, interactive coding experience in which you can use any of the functionality that Python offers.

To execute the code in the above cell, select it with a click and then either press the play button to the left of the code or use the keyboard shortcut “Shift-Enter”. To edit the code, just click the cell and start editing.

Cell outputs are not limited to simple text, however. They can contain any number of dynamic, rich outputs. For example, we can search Colab’s built-in library of code snippets and insert code to create an interactive data visualization.

With Colab you can harness the full power of popular Python libraries to analyze and visualize data. The code cell above uses your dataset for seaborn to visualize it. To edit the code, just click the cell and start editing.

You can import your own data into Colab notebooks from your Google Drive account, including from spreadsheets,

Click on the folder button on the left:

Click the Google Drive Folder icon and run the cell which appears, click the link, login to your account and copy the script, come back and paste the script in the code line and enter. Now you accepted Colap to reach your Google Drive.

Once you authenticate Colab to reach your drive the Google Drive icon will change as seen below and you will see the Drive and My Drive shortcuts. Now you can easily reach your files, folders, and colab notebooks you have created before.

You can also reach Github and many other sources.

Colab notebooks allow you to combine executable code and rich text in a single document, along with images, HTML, LaTeX, and more. When you create your own Colab notebooks, they are stored in your Google Drive account. “Colab Notebooks” folder is automatically created in your google drive. You can easily share your Colab notebooks with co-workers or friends, allowing them to comment on your notebooks or even edit them. Text cells are formatted using Markdown, a plain text document format that’s rendered on the page. Markdown format is simple and powerful, allowing you to add headings, paragraphs, lists, and even mathematical formulae.

Colab notebooks can be shared like a Google Doc, and for this purpose, it’s useful to use.

Text cells to provide a narrative around the code you’ve executed.

If you would like to share your notebooks with others, you can do so via Google Drive sharing or even by exporting your notebook to GitHub.

The notebook is stored in the standard Jupyter Notebook format, and so the notebooks you create can be viewed and executed in Jupyter Notebook, JupyterLab, and other compatible frameworks.

The convenience of sharing notebooks means that you can find and explore many interesting notebooks around the web.

Conclusion

Google Colab is a Jupyter Notebook which you can code easily. When you connect to the hosted runtime, you don’t consume your computer resources. You also don’t need an IDE on your computer. Text cells make editing much easier to add additional info and comments into your notebook. You can easily share your notebooks. Your friends or colleagues can contribute to your notebooks.

Consequently, Google Colab is easy to use and benefits from Google Drive options.

To learn more about Colab, follow me for the next stories.

https://idenw.medium.com/google-colab-2-dark-mode-runtime-share-github-69498e9057e2

Clarusway

We aim to set the new frontier in IT training with its…

Iden W.

Written by

Iden W.

Data Scientist

Clarusway

Clarusway

We aim to set the new frontier in IT training with its comprehensive and innovative approach in teaching while transforming individuals into IT professionals from the ground up.

Iden W.

Written by

Iden W.

Data Scientist

Clarusway

Clarusway

We aim to set the new frontier in IT training with its comprehensive and innovative approach in teaching while transforming individuals into IT professionals from the ground up.

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store