Skip to content

Instantly share code, notes, and snippets.

@csiebler
Last active January 23, 2024 11:03
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save csiebler/5895581704bb27b88f779c1fc03cab4c to your computer and use it in GitHub Desktop.
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