Introduction to Google Colab
The vast majority of coding examples in this course will be phrased in the form of a Python notebook. Google Colaboratory (or, just Google Colab) is an online interface for creating Python notebooks. It is extremely convenient because a vast set of Python modules (and, in particular, the modules used in this course) are already installed and, once imported, are ready for use.
Assuming you have a Gmail account and are logged in, click the link provided to run Google Colab notebooks. In the menu bar, choose
After doing so, you should see an editable code cell appear in which you can enter a series of Python instructions. Your notebook is automatically linked to the Google Drive associated with your Gmail account. Your Google Colab notebooks are automatically created on your Google Drive in My Drive in a folder named Colab Notebooks. You can treat them as files within Google Colab and perform typical file operations such as renaming, opening, and saving.
print('Hello world')
a = 10
print('a =', a)
- Click the Play button on the left side of the cell.
- Type Alt+Enter: runs the cell and inserts a new, empty code cell immediately following it.
- Type Shift+Enter: runs the cell and moves attention to the next cell (adding a new cell if none exists).
- Type Cmd/Ctrl+Enter: runs the cell, but control does not advance to the next cell (control remains "in place").
numpy
: array operationspandas
: dataframe operationsscipy.stats
: basic statisticsmatplotlib, pandas, seaborn
: visualizationscikit-learn
: data miningstatsmodels
: time series analysis
Upcoming units will explain and apply these modules. Before doing so, this unit will first review the basics of the Python programming language.