0 votes
1 view
in Azure by (3.8k points)

I need to read a CSV file, which is saved on my local computer, from code within an "Execute R/Python Script" in an experiment of Azure Machine Learning Studio. I don't have to upload the data, as usual, i.e. from Datasets -> New -> Load from a local file or with an Import Data module. I must do it with code. In principle, this is not possible, neither from an experiment nor from a notebook, and in fact, I always got the error. But I'm confused because the documentation about Execute Python Script module says (among other things):

Limitations

The Execute Python Script currently has the following limitations:

Sandboxed execution. The Python runtime is currently sandboxed and, as a result, does not allow access to the network or to the local file system in a persistent manner. All files saved locally are isolated and deleted once the module finishes. The Python code cannot access most directories on the machine it runs on, the exception being the current directory and its subdirectories.

According to the highlighted text, it should be possible to access and load a file from the current directory, using, for instance, the pandas function read_csv. But actually no. There is some trick to accomplish this?

1 Answer

0 votes
by (8k points)

Here is how you can do it:

1. Go to your experiment and select your data set. Upload your data set beforehand. 

2. Drag and drop it on the workspace.

3. Click on the data set to see the options. Click on Open in a new Notebook.

Select the version of python that is compatible with your csv file.

You can see the notebook:

...