Answers for "colab python with open file"

1

colab import python file

# In case anyone else is interested to know how to import files/packages 
# from gdrive inside a google colab. The following procedure worked for 
# me:

# 1) Mount your google drive in google colab:

from google.colab import drive
drive.mount('/content/gdrive/')

# 2) Append the directory to your python path using sys:

import sys
sys.path.append('/content/gdrive/mypythondirectory')

# Now you should be able to import stuff from that directory!
Posted by: Guest on April-08-2021
1

colab read file

from google.colab import files
import io
uploaded = files.upload()
df2 = pd.read_csv('Filename.csv')# Dataset is now stored in a Pandas Dataframe
Posted by: Guest on February-21-2020

Python Answers by Framework

Browse Popular Code Answers by Language