欧博allbetHow to use Google Colab to work with local

I have a Jupyter notebook and I have written codes to work with data. Now I want to use Google Colab for it's GPU computation power, so I need to read from and write to local files in my computer from Colab. I don't want to select file manually using:

from google.colab import files uploaded = files.upload()

mentioned in this link where a "select file" pop up will appear, I want this action to be automatically. Let me clarify that:
I have code below where I read data from a local file:

# Reading the csv file and convert it to a dataframe using pandas library train_set = pd.read_csv('Datasets/train.csv')

Then I per-process data and output the result in another file. To do that, I need to open a file, read the content of it which is the version of my created output file, and then save the output file:

output_version = open('OutputVersion','r+') version = output_version.read() training_set.to_csv('Datasets/training_set_processed_{}.csv'.format(version))

So, I have to read, manipulate and write files in my local storage from Colab automatically. How can I do that? I have read but I couldn't get that. Again, I don't want a 'select file' dialogue pop-up.

2025-10-25 23:57 点击量:3