This post represents a quick code sample in relation to uploading a CSV file from local drive to Google Colab Notebook.
Executing the code below will prompt to select a file from the local drive and upload.
import pandas as pd import io from google.colab import files uploaded = files.upload()
Once done with the above, all you need to do is execute the following code:
df = pd.read_csv(io.BytesIO(uploaded['FileName.csv']))
In order to test if the file is loaded appropriately, execute the following command:
- Mean Squared Error or R-Squared – Which one to use? - September 30, 2020
- Linear Regression Explained with Python Examples - September 30, 2020
- Correlation Concepts, Matrix & Heatmap using Seaborn - September 29, 2020