Accesing data is one of the first step that we need when performing any data analysis. In this tutorial, we will see two ways of loading data
into the google colab environment.
Uploading csv from local machine and loading into colab
Loading data from google drive to colab
Uploading CSV from local machine using IMPORT functionality.
Load import files library from google colab
upload file using the upload button control
Running below commands will allow us to upload data files into the colab environment. Once the Choose Files button is visible, after executing the below listed python commands, we can easily upload files from local directory.
To view the uploaded files
Below command allows us to verify if the file is uploaded correctly.
Uploading CSV from local machine using IMPORT functionality.
Running below commands will allow us to upload data files into the colab environment. Once the Choose Files button is visible, after executing the below listed python commands, we can easily upload files from local directory.
from google.colab import files uploaded = files.upload()Saving DOLPHIN.csv to DOLPHIN.csv
To view the uploaded files
Below command allows us to verify if the file is uploaded correctly.
for fn in uploaded.keys(): print('User uploaded file "{name}" with length {length} bytes'.format(name=fn, length=len(uploaded[fn])))User uploaded file "DOLPHIN.csv" with length 117269 bytes