0

I’m coming from a math background and learning some data science. I am very new to some details of this stuff.

Working with colab, I’m trying to organize my sample simulating functions in such a way that I can reach them even in different files/notebooks - and have not been able to find any working tutorials or explanations of how it works in colab.

The only things I’ve found have suggested using options that don’t seem to exist anymore - finding filepaths in it doesn’t seem to work as it once did.

Anyway, if anyone could guide me to a tutorial (or give some direct guidance), that would be greatly appreciated!!

Thanks a ton all, Paul

Paul
  • 1
  • 1

2 Answers2

0

I think you are trying to access a particular dataset/files inside a google colab notebooks of your wish. You can do that by simply uploading your data to your google drive from where you can access them inside your colab.

Once you have uploaded your data to your google drive of your google colab registered account (only accessible from your registered account), the run the following code in a code cell:

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

This will allow you to access your google drive contents from google colab notebook. You can access the drive files directly from the side-bar or simply using the python os library to manipulate the files as you wish.

0

I would suggest you put your Python files as .py files in a folder on your Google drive. You then need to mount this folder.

from google.colab import drive
drive.mount('/content/drive/<path_to_your_dir>')

And then you should be able to import them:

from <your lib(without .py)> import *