Skip to content

Instantly share code, notes, and snippets.

@csiebler

csiebler/mount_dataset.py

Last active Oct 1, 2020
Embed
What would you like to do?
Mount Dataset to Azure Machine Learning Compute Instance
import os
import pandas as pd
from azureml.core import Workspace, Dataset
# Connect to Workspace and reference Dataset
ws = Workspace.from_config()
dataset = ws.datasets["german-credit-train-tutorial"]
# Create mountcontext and mount the dataset
mount_ctx = dataset.mount()
mount_ctx.start()
# Get the mount point
dataset_mount_folder = mount_ctx.mount_point
print(dataset_mount_folder)
# List the files in the mount point
files = os.listdir(dataset_mount_folder)
print(files)
# Read some data
df = pd.read_csv(os.path.join(dataset_mount_folder, 'german_credit_data.csv'))
# Do some more stuff with the data....
# Unmount the dataset from the instance
mount_ctx.stop()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.