Teaching material for Quantitative Methods track in Semester 1
Install your python environment
Tutorial 1
Tutorial 2
Tutorial 3
Tutorial 4
Tutorial 5
Tutorial 6
For the most part, Google Colab works much the same as Jupyter notebooks in Anaconda, aside from some cosmetic differences. An important differences is that you can run the Jupyter notebooks on your computer locally, whereas Google Colab runs the code on a remote machine in the cloud.
You can still load files into Colab from a remote source in the same way as you would for Jupyter notebooks (see Loading Data from a Remote Source in Tutorial 4). However, you cannot load files from your computer in the same way because Colab is running on a different machine.
When you need to load data files into Colab, you need to make the file available to the remote machine that is running your code. There are a number of ways to do this:
import pandas as pd
data = pd.read_csv('BAGS_IntroSurvey.csv')
# mount your google drive so colab can access it
from google.colab import drive
drive.mount('/content/drive')
# load your data from your google drive
import pandas as pd
data = pd.read_csv('/content/drive/MyDrive/data.csv')
from google.colab import files
uploaded = files.upload()
This will produce a Browse...
button that allows you to find and upload the file
Then you can run the normal code for loading data locally, e.g.,
import pandas as pd
data = pd.read_csv('BAGS_IntroSurvey.csv')