Colab : Google colaboratory

Colab is Google Cloud based integrated development environment (IDE) for Python and Machine Learning.

Python libraries ( including Pandas , Numpy ) are already available and you only have to import them to start using. You need one google account to start using colab.

Upload Excel or CSV file in google drive and connect from Colab Python platform using mount drive

Advantage of using Colab

  1. Colab is a google cloud based platform so no need to install any application or software in you computer.
  2. Google provide many libraries to work in different areas of Python, we just need to call the required library and staring using them.
  3. All your files are hosted in google drive so it is easy to share with others and manage them.
  4. Files can be uploaded or downloaded from your local machine or from
    While uploading or downloading we can convert files to .py or .ipynb or even save as .pdf files.
  5. We can easily add TPU (Tensor Processing Unit) , GPU ( Graphics processing Unit) , CPU ( central processing unit ) for our advance study using google platform.

Adding Colab to your drive

Inside the google drive click New
adding colab to google drive
New > More > Google Colaboratory 
If this for first time you are using Colab then you need to add this App to your drive.
New > More > Connect More Apps
In new window search for Colab and add this to your drive.

You can share your Juytor notebook files through colab platform. Keep your files in google drive and share them with others.
Open a file or upload or import from github

Version of Python in Colab

Execute this line , it will display the version of python
!python --version

Adding CSV or Excel files to your code.

We can keep our CSV or Excel files in google drive and use it in our Colab platform.
  1. Upload your CSV or Excel file to any folder in google drive. We created one folder inside our Colab Notbooks folder and named it as downloads. You can give your own name to the folders.
  2. Now you have to mount the drive to your colab file. Run this code.
  3. from google.colab import drive
    You will be shown one link and below it there will be an text box asking for authorization code. Visit the link and collect ( copy ) your authorization code. You must be already logged in to your gmail account to get the code.
    Paste the code inside textbox and then press enter.
    Now your drive is mounted.

  4. Colab Drive Mounting
    In your left panel you can see drive icon. Expand the directory structure to reach and select your file you want to use. Right click and use copy path.
    Now use this path to create a variable to use in our read_excel() or read_csv() functions.
    import pandas as pd
    path='/content/drive/My Drive/Colab Notebooks/downloads/my_file.xlsx'
    my_data = pd.read_excel(path)
Connecting to CSV file on network.

Installing libraries in Colab

Installing Pytrends in google colab platform
Check if our required library is already available.
%pip freeze
If not available then install the same. Pytrends is an unofficial google trens api to get the data from google trends.
!pip install pytrends

Using SQLite in Colab

We can learn SQLite database management tools without installing any software of libraries by using google colab. SQLite is a file based database so it can be uploaded and placed in google drive. From Colab platform we can connect to SQLite database by using available libraries.
Without installing use SQLite database from google Drive by using Colab.
Python Home All Built in Functions in Python

Introduction to Google Colab, the cloud based platform for working on Python programs

Using .ipynb files as module and Docstrings in Colab

Subscribe to our YouTube Channel here


* indicates required
Subscribe to plus2net

    Post your comments , suggestion , error , requirements etc here

    Python Video Tutorials
    Python SQLite Video Tutorials
    Python MySQL Video Tutorials
    Python Tkinter Video Tutorials
    We use cookies to improve your browsing experience. . Learn more
    HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
    ©2000-2022 All rights reserved worldwide Privacy Policy Disclaimer